mikejw/elib-jwt

JWT Support for empathy

Maintainers

Package info

github.com/empathy-software/elib-jwt

Homepage

pkg:composer/mikejw/elib-jwt

Transparency log

Statistics

Installs: 153

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-17 07:05 UTC

This package is auto-updated.

Last update: 2026-07-19 07:06:14 UTC


README

JWT Support for Empathy Applications using https://github.com/firebase/php-jwt.

This extension depends on elib-base.

The JWT service will automatically be enabled for your application. (See services.php).

The two methods available with this extension are:

<php
$token = DI::getContainer()->get('JWT')->generate();

generate() uses a one-hour lifetime by default. Pass a lifetime in seconds when a different expiry is required:

<php
$ttl = 60 * 60 * 24 * 30;
$token = DI::getContainer()->get('JWT')->generate($ttl);

The default can be configured with the ELIB_JWT_TTL environment variable or the ELib JWT_TTL setting. getTTL() returns the resolved lifetime, which is useful when setting a browser cookie to the same expiry:

<php
$jwt = DI::getContainer()->get('JWT');
$ttl = $jwt->getTTL();
$token = $jwt->generate($ttl);

and

<php
$token = DI::getContainer()->get('JWT')->tryAuthenticate();

Licence

Empathy and officially released extension libraries are now distributed under an MIT license. See LICENSE.