eru123/jwt

HS256/SHA256 JWT Implementation

v1.0.1 2023-03-08 10:30 UTC

This package is auto-updated.

Last update: 2024-10-08 13:58:35 UTC


README

Simple and Straightforward JWT Library

<?php

require_once 'vendor/autoload.php';

use eru123\jwt\JWT;

$payload = [
    'hello' => 'world',
];
$key = 'secret';
$token = JWT::encode($payload, $key); // eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJoZWxsbyI6IndvcmxkIn0.bqxXg9VwcbXKoiWtp-osd0WKPX307RjcN7EuXbdq-CE
$decoded = JWT::decode($token, $key); // {"hello":"world"}