Git Product home page Git Product logo

codeigniter-vuejs-scss-webpack-boilerplate's Introduction

Codeigniter VueJS Webpack Boilerplate

Boilerplate Template for Codeigniter 
Pre Configured with Rest API + JWT + Web Sockets + VueJS + SCSS + Webpack

Features

=> Codeigniter 3
=> Rest API
=> JWT
=> Web Sockets
=> VueJS
=> SCSS
=> WebPack

Changes Required

change database settings in application/config/database.php
change folder path in .htaccess

Create New Rest API Controller

# First Include This File

require APPPATH . '/libraries/REST_Controller.php';

# Extent Controller 

class AdminAPI extends REST_Controller{

}

Generate Auth Token

$tokenData = array();
$tokenData['id'] = 1; // Replace with data for token
$tokenData['timestamp'] = now();
$output['token'] = AUTHORIZATION::generateToken($tokenData);
$this->set_response($output, REST_Controller::HTTP_OK);    

Verify Token

$decodedToken = $this->__VerifyJWT();

if($decodedToken){
    // VALID TOKEN
}else{
    // INVALID TOKEN
}

private function __VerifyJWT()
{
    $headers = $this->input->request_headers();

    if (array_key_exists('Authorization', $headers) && !empty($headers['Authorization'])) {
            $decodedToken = AUTHORIZATION::validateTimestamp($headers['Authorization']);
            // return response if token is valid
            if ($decodedToken != false) {
                return $decodedToken;
        }
    }
    return false;
}

VueJS Folder

All VueJS Files must be placed under "/VueJS/js/" folder

SCSS Folder

All SCSS Files must be placed under "/SCSS/" folder

Export VueJS + SCSS Code for Production

npm run production

Start Web Socket Server

php index.php websocket index

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.