jinpy666 / jwt
JSON Web Token (JWT)
1.0
2019-07-31 12:37 UTC
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2025-06-29 01:41:38 UTC
README
Example:
// Secret password $key = '1234'; // Claimset $claimSet = array( // user id 'iss' => '1', // Expiration Time 'exp' => strtotime(date('Y-m-d H:i:s') . ' + 1 day') ); $jwt = new \Jinpy666\Jwt\JsonWebToken(); // Create token $token = $jwt->encode($claimSet, $key); // check token $claimDecoded = $jwt->decode($token, $key); if($claimDecoded['valid'] == true) { echo 'Token is valid'; } else { echo 'Error: Token is not valid'; }