PHP code example of quangdung93 / jwt-redis

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

    

quangdung93 / jwt-redis example snippets


composer 

php artisan vendor:publish --provider="Ajax\JwtRedis\JwtRedisServiceProvider"


//Limit the number of tokens stored in redis
'limit_token' => 5,

//The keys in the payload are used to hash session_id
'key_payload_hash' => [ 
    'imei',
    'user_id'
],

// Except route affected by middleware
'route_except' => [
    'api/login'
]


// use Ajax\JwtRedis\Facades\JwtRedis;

$imei = '123';
$user_id = '1';

$params = [$imei, $user_id];

//$params is array s
JwtRedis::check($token, $params)