PHP code example of devmatheusguerra / jwt

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

    

devmatheusguerra / jwt example snippets



use Devmatheusguerra\JWT\JWT;

$jwt = new JWT();
$data = new stdClass();
$data->name = 'Devmatheusguerra';
$data->email = '[email protected]';

$token = $jwt->generate($data);

$tokenValido = $jwt->verify($token_recebido);
if($tokenValido)
	http_response_code(JWT::CREATED);
else
	http_response_code(JWT::FORBIDDEN);