PHP code example of prismo-smartpro / jwt

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

    

prismo-smartpro / jwt example snippets



* INICIA A CLASSE DO TOKEN
 */
$jwt = new \SmartPRO\Technology\JWT('123456');
$jwt->setExp(3600);
/*
 * CRIAR UM TOKEN A PARTIR DO PAYLOAD INFORMADO
 */
$token = $jwt->payload([
    "userId" => 165895
])->created();
/*
 * VERIFICA SE UM TOKEN INFORMADO É VÁLIDO
 */
try {
    $data = $jwt->verify('token');
} catch (Exception $e) {
    // Continue...
}