handle JWT token and validation

v2.2.1 2018-02-20 19:51 UTC

This package is auto-updated.

Last update: 2024-11-12 06:23:29 UTC


README

Build Status Coverage Status Latest Stable Version

JWT Token

require_once ("vendor/autoload.php");

$jwt = new \RW\JWT\Token();
$jwt->setIssuer('carambola')
    ->setAudience('jackfruit')
    ->setSecret("super-01-secret")
    ->setPayload(array("hello" => "world"))
    ->setExpiry(5);
$token = $jwt->getToken();
echo $token . "\n";

JWT Validation

$validator = \RW\JWT\Token::init($token);
$payload = $validator->setSecret("super-01-secret")
                ->validate()
                ->getPayload();
print_r($payload);