PHP code example of delboy1978uk / bone-paseto

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

    

delboy1978uk / bone-paseto example snippets




// use statements here
use Bone\Paseto\PasetoPackage;

return [
    'packages' => [
        // packages here...,
        PasetoPackage::class,
    ],
    // ...
];



return [
    'bone-paseto' => [
        'sharedKey' => 'tH1rtYtw0Ch4r4ct3rPasswordBlahXx',
    ],
];

$service = $c->get(Bone\Paseto\PasetoService::class);

$token = $this->paseto->encryptToken(['testing' => 123], 'P07D');
echo $token;

$token = $this->paseto->decryptToken($bigLongTokenStringHere);
var_dump($token->getClaims());

array (size=2)
  'testing' => int 123
  'exp' => string '2020-12-27T07:46:22+00:00' (length=25)