vakata/jwt

JWT token handling

4.0.1 2024-04-22 11:59 UTC

This package is auto-updated.

Last update: 2024-10-22 13:03:40 UTC


README

Latest Version on Packagist Software License Build Status Code Climate Tests Coverage

JWT token handling.

Install

Via Composer

$ composer require vakata/jwt

Usage

$token = new \vakata\jwt\JWT();
$token
    ->setClaim("key", "value")
    ->setExpiration("+30 days")
    ->setIssuer("System")
    ->sign("secretKey");

$stringified = (string)$token;
$parsed = \vakata\jwt\JWT::fromString($stringified);
var_dump($parsed->isValid()); // true
var_dump($parsed->isSigned()); // true
var_dump($parsed->verifyHash("secretKey")); // true
var_dump($parsed->getClaim("key")); // "value"

Read more in the API docs

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email github@vakata.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.