PHPackages                             freedomsex/jwt-manager - 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. freedomsex/jwt-manager

Abandoned → [a4sex/jwt-manager](/?search=a4sex%2Fjwt-manager)ArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

freedomsex/jwt-manager
======================

jwt-manager for FreedomSex project

0.3.2(4y ago)0944[1 PRs](https://github.com/freedomsex/jwt-manager/pulls)GPL-3.0-or-laterPHPPHP &gt;=7.4.0

Since Jun 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/freedomsex/jwt-manager)[ Packagist](https://packagist.org/packages/freedomsex/jwt-manager)[ RSS](/packages/freedomsex-jwt-manager/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (30)Used By (0)

JWT Manager
-----------

[](#jwt-manager)

> for FreedomSex projects
>
> for you without a guarantee of version compatibility, and everything else

Firebase\\JWT is used internally

You need to create keys for signing the token.

```
 mkdir -P /config/keys/
 cd config/keys

```

Keys Example
------------

[](#keys-example)

```
 openssl genrsa -out private.key 1024
 openssl rsa -in private.key -pubout -outform PEM -out public.key

```

Specify the paths when creating an instance of the manager. And *TimeToLive* generated token as the last argument

```
$manager = new JWTManager(
    '../keys/private.key',
    '../keys/public.key',
    $this->ttl
);
```

Generate JWT token
------------------

[](#generate-jwt-token)

Simple JWT token. Only Expires in payload

```
$token = $manager->create();
```

> eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2Mzg1NDkwMTN9.GfefYgNnxpUCU\_n8t0d37tQP-pjP7euGhrHTDx4T3ta0Eaa5Bedved5KbzZF-yXMUstnXr3TVRu3dkbKCaf0h2OJp13LT1WgvsyrkMIeO2KRG-vwsFrGrzAHRu2O5OKa7WI3sIFDE-oc\_khyPFvO01UdiLtpEISOh8ys3Dh32-8

**HEADER**

```
{
  "typ": "JWT",
  "alg": "RS256"
}
```

**PAYLOAD**

```
{
  "exp": 1638549013
}
```

### Payload based on User instance

[](#payload-based-on-user-instance)

```
$token = $manager->create($user);
// getId - uid
// getRoles - roles
// getIdentityId - uuid
// getAccess - access
// getSubject -sub
```

#### Deprecations

[](#deprecations)

`uuid` - deprecated since 0.4: use `uid` and `id`

```
$token = $manager->create($user);
// getId - id
// getUid - uid
// or
// getIdentityId - uid
```

```
// getId - id
// and
// getUid - uid (deprecated)
// and
// getIdentityId - uuid
```

#### Expires "alternative" way

[](#expires-alternative-way)

```
$token = $manager->create($user, 1638549013);
```

Load payload
------------

[](#load-payload)

```
$payload = $manager->load($token); // object return
$payload = (array) $manager->load($token); // array return
```

```
[
  "uid" => 1
  "exp" => 1638549013
]
```

### Inheritance and Overriding

[](#inheritance-and-overriding)

Override method `populatePayload` to Define your own structure

```
public function populatePayload(array $payload, $user = null): array
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~34 days

Recently: every ~5 days

Total

28

Last Release

1590d ago

PHP version history (2 changes)0.0.2PHP &gt;=7.2.0

0.2.3PHP &gt;=7.4.0

### Community

Maintainers

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

---

Top Contributors

[![tebaly](https://avatars.githubusercontent.com/u/9466814?v=4)](https://github.com/tebaly "tebaly (60 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[symfonycasts/reset-password-bundle

Symfony bundle that adds password reset functionality.

5238.0M32](/packages/symfonycasts-reset-password-bundle)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

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

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5161.1M3](/packages/robsontenorio-laravel-keycloak-guard)

PHPackages © 2026

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