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 1mo ago

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 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

1246d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b97408c87d2a48e8646f02734a01dfe6096518598e0c0cd49ec35b285128c07?d=identicon)[Thies](/maintainers/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

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[adhocore/jwt

Ultra lightweight JSON web token (JWT) library for PHP5.5+.

3031.6M15](/packages/adhocore-jwt)[psecio/jwt

A JWT (JSON Web Token) Encoding &amp; Decoding library

109352.2k2](/packages/psecio-jwt)[bizley/jwt

JWT integration for Yii 2

67425.3k2](/packages/bizley-jwt)[miladrahimi/php-jwt

A PHP implementation of JWT (JSON Web Token) generator, parser, verifier, and validator

70263.2k2](/packages/miladrahimi-php-jwt)[tuupola/branca

Authenticated and encrypted API tokens using modern crypto.

52309.2k1](/packages/tuupola-branca)

PHPackages © 2026

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