PHP code example of jobilla / laravel-jwt-validate

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

    

jobilla / laravel-jwt-validate example snippets




return [
    // ...

    'guards' => [
        // ...
        
        'jwt' => [
            'driver' => 'jwt-validate',
            'public_key_path' => storage_path('oauth-public.key'),
            'hydrator' => function (array $claims, \Illuminate\Http\Request $request) {
                return new App\User(['id' => $claims['sub']]);
            },
        ]
    ]
];