PHP code example of blaspsoft / token-forge

1. Go to this page and download the library: Download blaspsoft/token-forge 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/ */

    

blaspsoft / token-forge example snippets


use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}

public function share(Request $request): array
{
    return [
        ...parent::share($request),
        'auth' => [
            'user' => $request->user(),
        ],
        'flash' => [
            'tokenForge' => [
                'token' => fn () => session()->get('token'),
            ],
        ],
    ];
}

'default_permissions' => [
    'read',
],

'available_permissions' => [
    'create',
    'read',
    'update',
    'delete',
],
bash
composer install:api
php artisan migrate
bash
php artisan vendor:publish --tag=token-forge-config --force
bash
  php artisan token-forge:install blade
  
bash
  php artisan token-forge:install vue
  
bash
php artisan install:api
php artisan migrate
bash
php artisan vendor:publish --tag=token-forge-config --force