PHP code example of carlyip / jwt-common

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

    

carlyip / jwt-common example snippets



$jwt = new Jwt([
    'user' => 'test',
    'admin' => false
], 'mysecret');
var_dump($jwt->encrypt());


$token = 'eyJhbGciOiJIUzI1NiIsInR5cGUiOiJKV1QifQ==.eyJ1c2VyIjoidGVzdCIsImFkbWluIjpmYWxzZX0=.e5856c5e7797bec67ba24a7eb3ab97e4a9214db95b7f9fe5c20d487d996f6705';
$jwt   = new Jwt($token, 'mysecret');
var_dump($jwt->decrypt());