1. Go to this page and download the library: Download intoy/hebat-app library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
intoy / hebat-app example snippets
return [
/**
* Application name
*/
'name'=>'App',
/**
* Application Instance
*/
'instance'=>'Hebat Corporation',
/**
* Application title
*/
'title'=>'App - Hebat Corporation',
/**
* Application description
*/
'description'=>'Application Hebat Corporation',
/**
* Application version
*/
'version'=>'0.1',
/**
* Development Build
* development | dev | production | prod
*/
'env'=>'dev',
/**
* Cors allow origin
* Allow all set "*" value
* Example app response :
* Access-Control-Allow-Origin : "*"
*/
"cors_origin"=>null,
/**
* Register Timezone
*/
'timezone'=>'Asia/Makassar',
'providers'=>[
\App\Providers\AuthProvider::class,
],
]
use App\TokenJwt;
return [
// array route groups
// [key,path]
// key adalah key pada kernel middlewareGroups
// path ada path group pada route group $app->group($path);
// key juga akan di // Anda bisa menggunakan namespace berupa array, dengan catatan key array harus sesuai dengan key prefix
// Contoh
// "controllers"=>[
// "web"=>"App\\WebControllers\\"
// "api"=>"App\\ApiControllers\\"
// "test"=>"App\\TestControllers\\"
// ],
// atau bisa juga menggunnakan array array
// "controllers"=>[
// "web"=>[
// "App\\WebControllers\\"
// "App\\Web2Controllers\\"
// ],
// "api"=>"App\\ApiControllers\\"
// "test"=>"App\\TestControllers\\"
// ],
"controllers"=>"App\\Controllers\\",
// attribut yang akan diextract oleh middleware yang akan di bind ke parameter queryParams atau parseBody
"jwt_apply_params"=>[
"tahun",
"id_org"
],
// konfigurasi auth midleware JWTMiddleware
'jwt'=>[
'path'=>url_base('api'),
"ignore"=>[
url_base("api/report")
],
'leeway'=>60,
'secret'=>TokenJwt::SECRET_KEY,
'algorithm'=>'HS256',
'cookie'=>TokenJwt::JWT_COOKIE, //attribut di cookie
],
];
use App\TokenJwt;
use Intoy\HebatApp\JWTMiddleware\RequestMethodRule;
use Intoy\HebatApp\JWTMiddleware\RequestPathRule;
return [
///... your config prevous
// line jwt config
// konfigurasi auth midleware JWTMiddleware
'jwt'=>[
'secret'=>TokenJwt::SECRET_KEY, // key secreen
'algorithm'=>'HS256', // algoritm token JWT secret
'leeway'=>60, // leeway time JWT
'cookie'=>TokenJwt::JWT_COOKIE, //attribut di cookie
/**
* Path sebaiknya relative terhadap web sub folder
* Contoh misalnya path perlu pengecekan authentikasi adalah path "api"
* Dan folder web BERADA di subfolder "my-app" maka path direkomendasikan relative menjadi "my-app/api"
* Jika web TIDAK BERADA pada sub-folder maka cukup "api" atau "/api"
*/
"rules"=>[
// setup rule METHOD
new RequestMethodRule([
"ignore"=>["OPTIONS","GET"], // allows methods
]),
// setup secure path
new RequestPathRule([
"path"=>"api", // secure path
"ignore"=>[
"api/ping", // not secure this path
"api/report", // not secure this path
]
]),
]
],
]
return [
// Lax will sent the cookie for cross-domain GET requests
'cookie_samesite' => 'Lax',
// Optional: Sent cookie only over https
'cache_expire'=>60*24, // 1 hari
];
return [
'path'=>path_base('_cache'),
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.