This project is just a simple JWT class to add to your project and can be configured using contants.
- PHP >= 7.2
- Composer
You can clone the project with this command:
- Clone repository:
git clone https://github.com/GuilhermeTome/jwt
- Install in your project:
composer require guilhermetome/jwt
- Only follow the docs.
- In you application you need to create a const like this:
<?php
// the key of the application
define('JWT_SECRET', 'mysecret');
// the hash of the jwt
define('JWT_HASH', 'sha256');
// the alg to put in header
define('JWT_ALG', 'HS256');
- @param array
- @return string
<?php
use GuilhermeTome\Jwt;
echo Jwt::encode([
'user' => 'Guilherme',
'email' => '[email protected]',
'pass' => 'MyPassword'
]);
- @param string
- @return array|false
<?php
use GuilhermeTome\Jwt;
echo Jwt::decode($key);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
This project is licensed under the MIT Licence - see the MIT Licence for more details