summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnant Narayanan <anant@kix.in>2013-09-03 13:34:24 -0700
committerAnant Narayanan <anant@kix.in>2013-09-03 13:34:24 -0700
commit2a44e106a1c4752166983e373fdfdc38e18dd1ec (patch)
tree50bf3e2ac1f0601491b0b576ed41a8a2154668c3
parentb8acf5a5deab7b929a383c76470469baf68830ab (diff)
parent4d2ecb5f90fec878044bf8a6e7f97f9d597f5997 (diff)
downloadphp-jwt-2a44e106a1c4752166983e373fdfdc38e18dd1ec.zip
php-jwt-2a44e106a1c4752166983e373fdfdc38e18dd1ec.tar.gz
php-jwt-2a44e106a1c4752166983e373fdfdc38e18dd1ec.tar.bz2
Merge pull request #4 from phansys/master
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