PHP code example of zendrop / laravel-jwt

1. Go to this page and download the library: Download zendrop/laravel-jwt 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/ */

    

zendrop / laravel-jwt example snippets


'providers' => [
    ...
    Zendrop\LaravelJwt\LaravelJwtAuthServiceProvider::class,
]

use Zendrop\LaravelJwt\HasJwt;

class User extends Authenticatable {
    use HasJwt;
    ...
}

'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
        ...
    ],
    'api' => [
        'driver' => 'laravel-jwt', // Use the JWT guard
        'provider' => 'users', 
    ],
    ...
]

'guards' => [
    'web' => [
        'driver' => 'laravel-jwt-cookie',
        'provider' => 'users', 
    ],
]

bash
php artisan vendor:publish
bash
php artisan migrate