giftuals / tokenizer
PHP JWT library that allows you to create trustworthy links from and to your website or webapp
v1.0.0
2020-02-03 22:06 UTC
Requires
- php: >=7.2.0
Requires (Dev)
- kint-php/kint: dev-master
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-05-09 06:01:17 UTC
README
PHP JWT library that allows you to create trustworthy links from and to your website or webapp
Requirements
- PHP >= 7.2.0
Installation
composer require giftuals/tokenizer --dev
Usage
$config = new Tokenizer\Config\Config([ Tokenizer\Tokenizer::HASH_HMAC_KEY => 'some-uber-secret-key', Tokenizer\Tokenizer::CLAIM_ISSUER => 'Giftuals', Tokenizer\Tokenizer::CLAIM_SUBJECT => 'Example token', Tokenizer\Tokenizer::CLAIM_AUDIENCE => 'https://backend.giftuals.com', ]); $tokenizer = new Tokenizer\Tokenizer($config); $jwt = $tokenizer->createToken([ 'my_own_claim' => 'some random value', ]); try { $tokenizer->isValidToken($jwt); $payload = $tokenizer->getTokenPayload($jwt); } catch (Tokenizer\Exception\InvalidTokenException $e) { // Something went wrong }
Authors
Coen Coppens (giftuals)
License
Licensed under the MIT License