1. Go to this page and download the library: Download cboxdk/laravel-id-client 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/ */
$principal = CboxId::principal();
$principal->organization()?->role; // OrganizationRole::Admin
$principal->hasPermission('invoices:create');
$principal->isSupportSession(); // staff acting as this person
// config/cbox-id-client.php — CBOX_ID_PUBLISHABLE_KEY
use Cbox\Id\Client\Frontend\FrontendClient;
$config = app(FrontendClient::class)->config();
$acme = app(FrontendClient::class)->config('acme'); // the buttons acme's hosted page shows
$config->endpoint('authorization'); // where the form posts on to
$config->social; // the buttons this environment has enabled
$config->accent(); // the customer's brand colour
$config->isLive(); // false for a pk_test_ key — draw the badge
$session = app(FrontendClient::class)->session($accessToken);
$session->signedIn(); // false is a state, not an error
$session->user?->initials(); // 'AL' — for the avatar fallback
Route::get('/account', fn () => CboxId::redirectToProfile(returnTo: route('dashboard')));
// or just the URL: CboxId::profileUrl(route('dashboard'))