diff options
author | Phansys <phansys@gmail.com> | 2013-09-02 11:07:39 -0300 |
---|---|---|
committer | Phansys <phansys@gmail.com> | 2013-09-02 11:07:39 -0300 |
commit | 4d2ecb5f90fec878044bf8a6e7f97f9d597f5997 (patch) | |
tree | 50bf3e2ac1f0601491b0b576ed41a8a2154668c3 | |
parent | 66c3957571107fb35a0d441a9e109512cdc46f97 (diff) | |
download | php-jwt-4d2ecb5f90fec878044bf8a6e7f97f9d597f5997.zip php-jwt-4d2ecb5f90fec878044bf8a6e7f97f9d597f5997.tar.gz php-jwt-4d2ecb5f90fec878044bf8a6e7f97f9d597f5997.tar.bz2 |
Updated README.md.
-rw-r--r-- | README.md | 34 |
1 files changed, 21 insertions, 13 deletions
@@ -4,24 +4,32 @@ PHP-JWT A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the [current spec](http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06) +Installation +------------ + +Use composer to manage your dependencies and download PHP-JWT: + +```bash +php composer require firebase/php-jwt +``` + Example ------- ```php <?php - include_once 'Authentication/JWT.php'; - $key = "example_key"; - $token = array( +$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); +$jwt = JWT::encode($token, $key); +$decoded = JWT::decode($jwt, $key); - print_r($decoded); +print_r($decoded); ?> ``` @@ -30,12 +38,12 @@ Tests Run the tests using phpunit: ```bash - $ pear install PHPUnit - $ phpunit tests/ - PHPUnit 3.7.10 by Sebastian Bergmann. - ..... - Time: 0 seconds, Memory: 2.50Mb - OK (5 tests, 5 assertions) +$ 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 |