geraint/php-simple-jwt
最新稳定版本:v1.0.0
Composer 安装命令:
composer require geraint/php-simple-jwt
包简介
A simple JWT generator
README 文档
README
Warning
I built this as a learning excercise. It is not recommended for Production use. Use at your own risk.
A very simple implementation of the RS256 algorithm for signing JWT's.
It would be trivial to add support for more algorithms.
Installation
composer require geraint/php-simple-jwt:dev-main
Usage
The example script in the /bin directory looks like this:
<?php require __DIR__ . '/../vendor/autoload.php'; use PhpSimpleJwt\Rs256Jwt; $privateKey = file_get_contents(__DIR__ . '/../tests/private_key.pem'); assert(is_string($privateKey)); $jwt = new Rs256Jwt( [ 'alg' => 'RS256', 'typ' => 'JWT', ], [ 'name' => 'Joe Bloggs', ], $privateKey ); $signedToken = $jwt->getSignedToken(); echo "{$signedToken}\n";
Running php bin/example.php outputs:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9lIEJsb2dncyJ9.PHb2DMbz95SiFjZWe5lre82pZXuBQ3P-PiHEZX8vJCOlxicvWhf9f8rm8_PCNisTvIcox0I6VyLVc1bwH6bfLvmC_n2Wkx4JI4KMybjQfgNNpjaRObt8SR6AxLvSZjeScbXwflMxP82UeexaJ5THxAT0y77Fvwb53T7W4haxRLwsU17OG4BcSi8_vLofXcluRJUO0Iz9N0Q6UKe_bw5aJFG9ZSvYNy1CQzUAOucSrL7YIu9Dt6zdwlTUcvLkriZc1jr2ItMjlSE2rbKcKx7HMpbtHEZ8GUlWTUX_wj7q6MYI1YQP3h_VW7kLUEaiG5TF8FamaU4DTu6pRbat5mtkhg
统计信息
- 总下载量: 213
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2023-05-19