Boilerplate Template for Codeigniter
Pre Configured with Rest API + JWT + Web Sockets + VueJS + SCSS + Webpack
=> Codeigniter 3
=> Rest API
=> JWT
=> Web Sockets
=> VueJS
=> SCSS
=> WebPack
change database settings in application/config/database.php
change folder path in .htaccess
# First Include This File
require APPPATH . '/libraries/REST_Controller.php';
# Extent Controller
class AdminAPI extends REST_Controller{
}
$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);
$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;
}
All VueJS Files must be placed under "/VueJS/js/" folder
All SCSS Files must be placed under "/SCSS/" folder
npm run production
php index.php websocket index