PHPackages                             thies/json-web-token - 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. thies/json-web-token

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

thies/json-web-token
====================

JSON Web Token library written in PHP

v1.0.0(3y ago)03MITPHPPHP ^8.1

Since Dec 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/thies4321/json-web-token)[ Packagist](https://packagist.org/packages/thies/json-web-token)[ Docs](https://github.com/thies4321/json-web-token)[ RSS](/packages/thies-json-web-token/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

json-web-token
==============

[](#json-web-token)

JSON Web Token library written in PHP

Installation
------------

[](#installation)

```
composer require thies/json-web-token

```

Usage
-----

[](#usage)

### Encoding

[](#encoding)

```
$header = [
    'alg' => 'HS256',
    'typ' => 'JWT',
];

$payload = [
    'sub' => '1234567890',
    'name' => 'John Doe',
    'iat' => 1516239022
];

$encodedToken = \JsonWebToken\JWT::encode($header, $payload, 'your-passphrase-or-key');

$encodedToken->get(); // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.g0nxZDyzNvuhhuPrpwZFNdtGH2q0AQ0jbTdr5g5NMeA
$encodedToken->getHeader(); // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
$encodedToken->getPayload(); // eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ
$encodedToken->getSignature(); // g0nxZDyzNvuhhuPrpwZFNdtGH2q0AQ0jbTdr5g5NMeA

echo $encodedToken // eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.g0nxZDyzNvuhhuPrpwZFNdtGH2q0AQ0jbTdr5g5NMeA
```

Decoding
--------

[](#decoding)

```
$jwtToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.g0nxZDyzNvuhhuPrpwZFNdtGH2q0AQ0jbTdr5g5NMeA';

$decodedToken = \JsonWebToken\JWT::decode($jwtToken, 'your-passphrase-or-key');

$decodedToken->getHeader(); // array
$decodedToken->getPayload(); // array
$decodedToken->isValid(); // bool
```

Supported algorithms
--------------------

[](#supported-algorithms)

AlgorithmSupportedHS256✔️HS384✔️HS512✔️PS256❌PS384❌PS512❌RS256✔️RS384✔️RS512✔️ES256❌ES256K❌ES384❌ES512❌EdDSA❌

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1294d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/509234?v=4)[Thies](/maintainers/Thies)[@thies](https://github.com/thies)

---

Top Contributors

[![thies4321](https://avatars.githubusercontent.com/u/7131864?v=4)](https://github.com/thies4321 "thies4321 (22 commits)")

---

Tags

jwttoken

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/thies-json-web-token/health.svg)

```
[![Health](https://phpackages.com/badges/thies-json-web-token/health.svg)](https://phpackages.com/packages/thies-json-web-token)
```

###  Alternatives

[web-token/jwt-framework

JSON Object Signing and Encryption library for PHP and Symfony Bundle.

95220.7M103](/packages/web-token-jwt-framework)[web-token/jwt-bundle

JWT Bundle of the JWT Framework.

132.7M8](/packages/web-token-jwt-bundle)

PHPackages © 2026

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