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

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

fgsl/jwt
========

Fgsl JWT Handler

1.2.2(3mo ago)11523AGPL-3.0-onlyPHPPHP &gt;=7.4CI failing

Since Oct 23Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/fgsl/jwt)[ Packagist](https://packagist.org/packages/fgsl/jwt)[ Docs](https://github.com/fgsl/jwt)[ RSS](/packages/fgsl-jwt/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (1)Versions (10)Used By (3)

Fgsl JWT
========

[](#fgsl-jwt)

For creating a JWT token, you must before create an instance of `Fgsl\Jwt\Jwt`. After, you call method `getBearerToken`. This method will store the username in the token as the `sub` attribute. Additional attributes can be sent in an array as the third argument.

For recovering the payload from a given token, call the static method `getPayload`.

You can see a use example below. You can run this test from [JwtTest](./tests/Fgsl/Jwt/JwtTest.php) class using PHPUnit.

```
    public function testBearerToken()
    {
        $jwt = new Jwt(['RS256','sha256'], 'JWT', 'newbraveworld.com', 'PT2H');

        $bearerToken = $jwt->getBearerToken('foouser','baapassword',['role' => 'admin']);

        $this->assertTrue(is_string($bearerToken));
        $this->assertNotEmpty($bearerToken);

        $payload = Jwt::getPayload($bearerToken);

        $this->assertTrue(is_object($payload));

        $this->assertEquals('foouser', $payload->sub);
        $this->assertEquals('newbraveworld.com', $payload->iss);
        $this->assertEquals('admin',$payload->role);

        $this->assertFalse(Jwt::expired($bearerToken));
    }
```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance80

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~381 days

Recently: every ~540 days

Total

7

Last Release

107d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.0

1.1.2PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2cb6d4497d6c4358a5c7e7e31d34412f5d6e9617aafa487b125bcc870171cd1e?d=identicon)[fgsl](/maintainers/fgsl)

---

Top Contributors

[![fgsl](https://avatars.githubusercontent.com/u/128915?v=4)](https://github.com/fgsl "fgsl (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

jwtAuthentication

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.0M3](/packages/auth0-login)[rbdwllr/reallysimplejwt

A really simple library to generate user authentication JSON Web Tokens.

2902.4M22](/packages/rbdwllr-reallysimplejwt)[admad/cakephp-jwt-auth

CakePHP plugin for authenticating using JSON Web Tokens

160680.3k8](/packages/admad-cakephp-jwt-auth)

PHPackages © 2026

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