PHP code example of guilhermetome / jwt

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

    

guilhermetome / jwt example snippets




// the key of the application
define('JWT_SECRET', 'mysecret');

// the hash of the jwt
define('JWT_HASH', 'sha256');

// the alg to put in header
define('JWT_ALG', 'HS256');



use GuilhermeTome\Jwt;

echo Jwt::encode([
    'user' => 'Guilherme',
    'email' => '[email protected]',
    'pass' => 'MyPassword'
]);



use GuilhermeTome\Jwt;

echo Jwt::decode($key);