socialconnect / jwx
PHP library for JSON web tokens (JWT) and JWT
Installs: 416 924
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 3
Open Issues: 0
Requires
- php: >=7.1
- ext-json: *
Requires (Dev)
- phpstan/phpstan-shim: ^0.11.12
- phpunit/phpunit: ^7.5
Suggests
- ext-openssl: Please install openssl extension to use RS encryption
README
Documentation :: Getting Started
Implementation:
Encode
<?php $jwt = new \SocialConnect\JWX\JWT([ 'uid' => 5, ]); $encodeOptions = new \SocialConnect\JWX\EncodeOptions(); $encodeOptions->setExpirationTime(600); $token = $jwt->encode('TEST', 'HS256', $encodeOptions); var_dump($token);
Decode
<?php $decodeOptions = new \SocialConnect\JWX\DecodeOptions(['HS256']); $token = \SocialConnect\JWX\JWT::decode('TEST', $token, $decodeOptions); var_dump($token);
License
This project is open-sourced software licensed under the MIT License.
See the LICENSE file for more information.