PHP code example of juanchosl / tokenizer

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

    

juanchosl / tokenizer example snippets


$options = [
    JwtToken::OPTION_ISSUER => $_ENV['CYPHER_KEY'],
    JwtToken::OPTION_AUDIENCE => 'Restricted area'
];
$tokenizer = new JuanchoSL\Tokenizer\Repositories\JwtToken($options);
$token = $tokenizer->encode(new Credential($username, $password));

$user_data = $tokenizer->decode($token);

$tokenizer->check($db_data, $token):

$options = [
    JwtToken::OPTION_ISSUER => $_ENV['CYPHER_KEY'],
    JwtToken::OPTION_AUDIENCE => 'Restricted area'
];
$tokenizer = new JuanchoSL\Tokenizer\Repositories\JwtToken($options);
$service = new Authentication($tokenizer, new Credentials);
$service->authenticateByCredential($credential);
return $service->generateToken($credential);

$options = [
    JwtToken::OPTION_ISSUER => $_ENV['CYPHER_KEY'],
    JwtToken::OPTION_AUDIENCE => 'Restricted area'
];
$tokenizer = new JuanchoSL\Tokenizer\Repositories\JwtToken($options);
$service = new Authentication($tokenizer, new Credentials);
return $service->->authenticateByToken($token);