jwmickey/php-jwt

Json Web Token for PHP

This package's canonical repository appears to be gone and the package has been frozen as a result.

Maintainers

Details

github.com/jwmickey/php-jwt

Installs: 130 786

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 3

Forks: 1 406

dev-master 2014-08-25 01:51 UTC

This package is not auto-updated.

Last update: 2024-01-16 00:02:01 UTC


README

This was forked from firebase/php-jwt, which now has it's own composer.json file. I recommend you use the original source as this fork is no longer maintained.

JWT Implementation in PHP

Travis

<?php
require_once './vendor/autoload.php';

$jwt = JWT::encode($token, $key);
$decoded = JWT::decode($jwt, $key);
?>

Installation

{
    "require": {
        "jwmickey/php-jwt": "dev-master"
    }
}

PHP-JWT

A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec

Example

<?php
require_once './vendor/autoload.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);
?>

Tests

Run the tests using phpunit:

git clone https://github.com/jwmickey/php-jwt.git && \
cd php-jwt && \
mkdir bin && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=bin && \
./bin/composer.phar install --dev && \
./bin/phpunit

License

3-Clause BSD.