revenuewire / jwt
handle JWT token and validation
v2.2.1
2018-02-20 19:51 UTC
Requires
- aws/aws-sdk-php: ^3.36
Requires (Dev)
- php-coveralls/php-coveralls: ^1.0
- phpunit/phpunit: ^5.5.0
README
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);