PHP code example of naux / jwt-simple

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

    

naux / jwt-simple example snippets


$secret = 'xxx';

$jwt = new \Naux\JWT($secret); 
$payload = ['iss' => 1, 'exp' => 1450539234, 'foo' => 'bar'];

// encode
$token = $jwt->encode($payload);

// decode
$decoded = $jwt->decode($token);

var_dump($decoded);

// using HS512
$jwt = new JWT('secret', 'HS512');