ekok/php-jwt

v0.1.0 2022-03-28 06:17 UTC

This package is auto-updated.

Last update: 2024-10-28 12:14:13 UTC


README

Based on firebase/php-jwt

<?php

$options = array(
    'key' => 'mySecr3TKey~',
    // options defaults value
    // 'id' => null, // or jti
    // 'leeway' => 0,
    // 'keyId' => null,
    // 'publicKeys' => array(),
    // 'header' => array(),
    // 'algorithm' => null, // or alg
    // 'issuer' => null, // or iss
    // 'expires' => null, // or exp
    // 'subject' => null, // or sub
    // 'audience' => null, // or aud
    // 'notBefore' => null, // or nbf
    // 'issuedAt' => null, // or iat
);
$jwt = new Ekok\JWT\Manager($options);
$payload = array(
    'foo' => 'bar',
);
$token = $jwt->encode($payload);
$decoded = $jwt->decode($token);

// $decoded === $payload