@@ -4,24 +4,32 @@ PHP-JWT
44A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should
55conform to the [ current spec] ( http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06 )
66
7+ Installation
8+ ------------
9+
10+ Use composer to manage your dependencies and download PHP-JWT:
11+
12+ ``` bash
13+ php composer require firebase/php-jwt
14+ ```
15+
716Example
817-------
918``` php
1019<?php
11- include_once 'Authentication/JWT.php';
1220
13- $key = "example_key";
14- $token = array(
21+ $key = "example_key";
22+ $token = array(
1523 "iss" => "http://example.org",
1624 "aud" => "http://example.com",
1725 "iat" => 1356999524,
1826 "nbf" => 1357000000
19- );
27+ );
2028
21- $jwt = JWT::encode($token, $key);
22- $decoded = JWT::decode($jwt, $key);
29+ $jwt = JWT::encode($token, $key);
30+ $decoded = JWT::decode($jwt, $key);
2331
24- print_r($decoded);
32+ print_r($decoded);
2533?>
2634```
2735
@@ -30,12 +38,12 @@ Tests
3038Run the tests using phpunit:
3139
3240``` bash
33- $ pear install PHPUnit
34- $ phpunit tests/
35- PHPUnit 3.7.10 by Sebastian Bergmann.
36- .....
37- Time: 0 seconds, Memory: 2.50Mb
38- OK (5 tests, 5 assertions)
41+ $ pear install PHPUnit
42+ $ phpunit --configuration phpunit.xml.dist
43+ PHPUnit 3.7.10 by Sebastian Bergmann.
44+ .....
45+ Time: 0 seconds, Memory: 2.50Mb
46+ OK (5 tests, 5 assertions)
3947```
4048
4149License
0 commit comments