PHP code example of jasminecms / jasmine
1. Go to this page and download the library: Download jasminecms/jasmine 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/ */
jasminecms / jasmine example snippets
Route::prefix('jasmine')->group(fn() => Jasmine::routes());
Route::prefix('jasmine')->group(fn() => Jasmine::apiRoutes());
Jasmine::registerLocales(['en', 'he']);
Jasmine::registerBreadable(\App\Models\MyModel::class);
Jasmine::registerPage(\App\Pages\Home::class);
Jasmine::registerInterfaceLocale('he', 'path/to/locale.json');
Jasmine::registerCustomStyle('/path/to/style.css');
Jasmine::registerCustomJs('/path/to/app.js');
// internal
\Jasmine::registerSideBarMenuItem('settings', fn() => [
'title' => __('Settings'),
'icon' => 'bi-link-45deg text-danger',
'href' => route('jasmine.my.route', 'my-param-value'),
'is-route' => ['r' => 'jasmine.my.route', 'p' => ['my-param' => 'my-param-value']],
], 70);
// external
\Jasmine::registerSideBarMenuItem('site-triple', fn() => [
'href' => 'https://triple.co.il',
'title' => 'Triple',
'icon' => 'bi-link-45deg text-danger',
'target' => '_blank',
], 100);
Jasmine::registerOauth2Sso(
'Facebook', //name
'https://www.facebook.com/images/fb_icon_325x325.png', //icon
'{client_id}',
'{client_secret}',
'https://www.facebook.com/v3.3/dialog/oauth',
'https://graph.facebook.com/v3.3/oauth/access_token',
['email'],
false, // accepts boolean or callback
function ($token) {
$token = json_decode($token, true);
$res = Http::asJson()->get('https://graph.facebook.com/v3.3/me', [
'access_token' => $token['access_token'],
'fields' => 'name,email',
]);
return [
'name' => $res->json('name'),
'email' => $res->json('email'),
];
},
);