guilhermetome/jwt
Composer 安装命令:
composer require guilhermetome/jwt
包简介
A simple jwt class
README 文档
README
This project is just a simple JWT class to add to your project and can be configured using contants.
Summary
Prerequisites
- PHP >= 7.2
- Composer
Installing
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
How to use
- Only follow the docs.
Declare the jwt key
- 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');
Generate the jwt key
- @param array
- @return string
<?php
use GuilhermeTome\Jwt;
echo Jwt::encode([
'user' => 'Guilherme',
'email' => 'email@gmail.com',
'pass' => 'MyPassword'
]);
Decode the jwt key
- @param string
- @return array|false
<?php
use GuilhermeTome\Jwt;
echo Jwt::decode($key);
Contributing
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.
License
This project is licensed under the MIT Licence - see the MIT Licence for more details
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-17