summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhansys <phansys@gmail.com>2013-09-02 11:07:39 -0300
committerPhansys <phansys@gmail.com>2013-09-02 11:07:39 -0300
commit4d2ecb5f90fec878044bf8a6e7f97f9d597f5997 (patch)
tree50bf3e2ac1f0601491b0b576ed41a8a2154668c3
parent66c3957571107fb35a0d441a9e109512cdc46f97 (diff)
downloadphp-jwt-4d2ecb5f90fec878044bf8a6e7f97f9d597f5997.zip
php-jwt-4d2ecb5f90fec878044bf8a6e7f97f9d597f5997.tar.gz
php-jwt-4d2ecb5f90fec878044bf8a6e7f97f9d597f5997.tar.bz2
Updated README.md.
-rw-r--r--README.md34
1 files changed, 21 insertions, 13 deletions
diff --git a/README.md b/README.md
index 61989ae..d0be097 100644
--- a/README.md
+++ b/README.md
@@ -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