naux / jwt-simple
Installs: 376
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
pkg:composer/naux/jwt-simple
Requires
- namshi/jose: ^6.0
README
JWT(JSON Web Token) encode and decode module for PHP.
Install
$ composer require naux/jwt
Usage
$secret = 'xxx'; $jwt = new \Naux\JWT($secret); $payload = ['iss' => 1, 'exp' => 1450539234, 'foo' => 'bar']; // encode $token = $jwt->encode($payload); // decode $decoded = $jwt->decode($token); var_dump($decoded);
Algorithms
By default the algorithm to encode is HS256.
The supported algorithms for encoding and decoding are ECDSA, ES256, ES384, ES512, HMAC, HS256, HS384, HS512, PublicKey, RS256, RS384, RS512, RSA.
// using HS512 $jwt = new JWT('secret', 'HS512');