2017 © Pedro Peláez
 

library pjose

PHP library to implements JOSE (Javascript Object Signing and Encryption)

image

mostofreddy/pjose

PHP library to implements JOSE (Javascript Object Signing and Encryption)

  • Saturday, August 16, 2014
  • by mostofreddy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 5 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PJOSE

PHP library to implements JOSE (Javascript Object Signing and Encryption), (*1)

Build Status Latest Stable Version Total Downloads License, (*2)

Documentation for JSON Web Tokens

Features

  • Implements JSON Web Token (JWT) and Signature (JWS)
  • Supported Algorithms: HS256, HS384 and HS 512
  • Verify signed tokens
  • JWE (Comming soon)

Version

1.0.0, (*3)

Install

Requirements

Via composer

This tool can be installed via Composer:, (*4)

{
    "require": {
        ""mostofreddy/pjose": "*"
    }
}

License

The MIT License (MIT). Please see License File for more information., (*5)

How is it used?

JWT

Encoding

try {

    $jwt = new \mostofreddy\pjose\Jwt();
    $claims = array('name' => "mosto");
    $jwt->claims($claims);
    $token = (string) $jwt;

    echo $token.PHP_EOL;

} catch (\Exception $e) {
    echo "ERROR: ".$e->getMessage().PHP_EOL;
}

Decoding

try {

    $jwt = new \mostofreddy\pjose\Jws();
    $data = $jwt->decode($token);

    var_dump($token);

} catch (\Exception $e) {
    echo "ERROR: ".$e->getMessage().PHP_EOL;
}

JWS

Signing

try {

    $jws = new \mostofreddy\pjose\Jws();
    $claims = array('name' => "mosto");
    $jws->claims($claims);
    $jws->sign('secret');
    $token = (string) $jws;

    echo $token.PHP_EOL;

} catch (\Exception $e) {
    echo "ERROR: ".$e->getMessage().PHP_EOL;
}

Verification

try {

    $jws = new \mostofreddy\pjose\Jws();
    $result = $jwt->verify('secret', $token);

    var_dump($result);

} catch (\Exception $e) {
    echo "ERROR: ".$e->getMessage().PHP_EOL;
}

Examples

Example directory, (*6)

Run Tests

php vendor/bin/phpunit -c tests/phpunit.xml 

The Versions

16/08 2014

dev-master

9999999-dev https://github.com/mostofreddy/pjose

PHP library to implements JOSE (Javascript Object Signing and Encryption)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

jwt jws json web token jwe jose json web signature json web encryption openid connect id token

16/08 2014

1.0.0

1.0.0.0 https://github.com/mostofreddy/pjose

PHP library to implements JOSE (Javascript Object Signing and Encryption)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

jwt jws json web token jwe jose json web signature json web encryption openid connect id token

30/07 2014

0.1.0

0.1.0.0 https://github.com/mostofreddy/pjose

PHP library to implements JOSE (Javascript Object Signing and Encryption)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

jwt jws json web token jwe jose json web signature json web encryption openid connect id token