50onred/php-jwt
最新稳定版本:1.0.3
Composer 安装命令:
composer require 50onred/php-jwt
包简介
A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
README 文档
README
PHP-JWT
A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec
Installation
Use composer to manage your dependencies and download PHP-JWT:
composer require firebase/php-jwt
Example
<?php $key = "example_key"; $token = array( "iss" => "http://example.org", "aud" => "http://example.com", "iat" => 1356999524, "nbf" => 1357000000 ); $jwt = JWT::encode($token, $key); $decoded = JWT::decode($jwt, $key); print_r($decoded); /* NOTE: This will now be an object instead of an associative array. To get an associative array, you will need to cast it as such: */ $decoded_array = (array) $decoded; ?>
Tests
Run the tests using phpunit:
$ pear install PHPUnit $ phpunit --configuration phpunit.xml.dist PHPUnit 3.7.10 by Sebastian Bergmann. ..... Time: 0 seconds, Memory: 2.50Mb OK (5 tests, 5 assertions)
License
统计信息
- 总下载量: 62
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-01-13