PHPackages                             imemento/jwt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. imemento/jwt

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

imemento/jwt
============

Custom JWT logic

12.0.0(4mo ago)03.0k4MITPHPPHP ^8.2CI failing

Since Mar 22Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/mementohub/jwt)[ Packagist](https://packagist.org/packages/imemento/jwt)[ Docs](https://github.com/mementohub/jwt)[ RSS](/packages/imemento-jwt/feed)WikiDiscussions v8.1.x Synced yesterday

READMEChangelogDependencies (2)Versions (19)Used By (4)

iMemento JWT Wrapper
====================

[](#imemento-jwt-wrapper)

[![Build Status](https://github.com/mementohub/jwt/workflows/Testing/badge.svg)](https://github.com/mementohub/jwt/actions)[![Latest Stable Version](https://camo.githubusercontent.com/d68ffee7cd21b7a0a70fcf3769686465a9b745fc1504709edd2304b860d13fb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d656d656e746f2f6a7774)](https://packagist.org/packages/imemento/jwt)[![License](https://camo.githubusercontent.com/5fa933a546f440a712555caf34072cbf51e9b2d384637fd52f3111721f98566d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696d656d656e746f2f6a7774)](https://packagist.org/packages/imemento/jwt)[![Total Downloads](https://camo.githubusercontent.com/b7a04dff2cb6aafc9ca0e1bcee8c39cff1e2e82b74746828d7c1bd27446295e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696d656d656e746f2f6a7774)](https://packagist.org/packages/imemento/jwt)

A custom JWT Wrapper to be used in iMemento projects. It uses the **RS256** algorithm and it is framework independent.

Install
-------

[](#install)

```
composer require imemento/jwt
```

Usage
-----

[](#usage)

```
use iMemento\JWT\JWT;
```

### Encoding

[](#encoding)

To encode a JWT just use the `encode` static method:

```
/**
 * $payload object/array
 * $privateKey mixed the key used to sign the token
 */
$token = JWT::encode($payload, $private_key);
```

### Decoding

[](#decoding)

To decode a JWT we must follow the next steps.

1. Instantiate the class with the token we want to decode:

    ```
    $jwt = new JWT($token);
    ```
2. Get the issuer before checking the signature (used to find the correct public key):

    ```
    $issuer = $jwt->getIssuer();
    ```
3. Get the payload and check the signature at the same time:

    ```
    $payload = $jwt->decode($public_key);
    ```

### Additional Classes

[](#additional-classes)

*Guard.php* - Decrypts the token and is used to extract the permissions from it.

*Issuer.php* - Represents the current application.

*Payload.php* - Is used to create a standard payload for the JWT.

[Test Token Data Structure](test-token.md)

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance76

Regular maintenance activity

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 84.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~170 days

Recently: every ~492 days

Total

18

Last Release

131d ago

Major Versions

5.8.0 → 6.0.02020-09-29

v6.0.x-dev → v7.0.x-dev2020-09-29

7.0.0 → v8.0.x-dev2020-09-29

v8.1.0 → v12.0.0.x-dev2026-02-19

PHP version history (6 changes)5.6.0PHP ^7.1

6.0.0PHP ^7.2

v7.0.x-devPHP ^7.2.5

v8.0.x-devPHP ^7.3

v8.1.x-devPHP ^8.0

v12.0.0.x-devPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef360de3f6d1e1a2eb47c55b310bf697192f25dff9bf9733607404e1bf0ddc63?d=identicon)[bcismariu](/maintainers/bcismariu)

---

Top Contributors

[![gxgstan](https://avatars.githubusercontent.com/u/3264036?v=4)](https://github.com/gxgstan "gxgstan (55 commits)")[![bcismariu](https://avatars.githubusercontent.com/u/10166477?v=4)](https://github.com/bcismariu "bcismariu (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/imemento-jwt/health.svg)

```
[![Health](https://phpackages.com/badges/imemento-jwt/health.svg)](https://phpackages.com/packages/imemento-jwt)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k286.7M205](/packages/google-auth)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2276.2M36](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5181.1M3](/packages/robsontenorio-laravel-keycloak-guard)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

121242.9k1](/packages/ellaisys-aws-cognito)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

153.8M9](/packages/microsoft-kiota-authentication-phpleague)[rainlab/user-plugin

User plugin for October CMS

11854.7k15](/packages/rainlab-user-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
