PHPackages                             level51/silverstripe-jwt-utils - 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. level51/silverstripe-jwt-utils

ActiveSilverstripe-vendormodule[Authentication &amp; Authorization](/categories/authentication)

level51/silverstripe-jwt-utils
==============================

Utilities for dealing with JWT in SilverStripe

1.0.0(2y ago)27.0k—0%4[1 PRs](https://github.com/Level51/silverstripe-jwt-utils/pulls)1MITPHPCI failing

Since Feb 3Pushed 2y ago3 watchersCompare

[ Source](https://github.com/Level51/silverstripe-jwt-utils)[ Packagist](https://packagist.org/packages/level51/silverstripe-jwt-utils)[ RSS](/packages/level51-silverstripe-jwt-utils/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (8)Used By (1)

JWT Utils for SilverStripe
==========================

[](#jwt-utils-for-silverstripe)

[![Build Status](https://camo.githubusercontent.com/4ca51059aee835a13bb24f698b9efda069f7ded29644279ab8136955cc1ba4f9/68747470733a2f2f7472617669732d63692e6f72672f4c6576656c35312f73696c7665727374726970652d6a77742d7574696c732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Level51/silverstripe-jwt-utils)

Lean set of helper classes to deal with JWT in SilverStripe setups.

Install
-------

[](#install)

```
composer require level51/silverstripe-jwt-utils

```

Module VersionPHP Version1.x&gt;=80.x&lt;8Example
-------

[](#example)

```
use Level51\JWTUtils\JWTUtils;
use Level51\JWTUtils\JWTUtilsException;

class MyTokenController extends Controller {

    private static $allowed_actions = ['token'];

    public function token() {
        try {
            $payload = JWTUtils::inst()->byBasicAuth($this->request);

            return json_encode($payload);
        } catch(JWTUtilsException $e) {
            return $this->httpError(403, $e->getMessage());
        }
    }
}
```

With correct config and credentials there will be a payload like the following:

```
{
	"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtZW1iZXJJZCI6MSwiaXNzIjoiaHR0cDpcL1wvc2lsdmVyZ3JvdW5kLm1lXC8iLCJleHAiOjE1MTgyNzMwMjIsImlhdCI6MTUxNzY2ODIyMiwicmF0IjoxNTE3NjY4MjIyLCJqdGkiOiI0ZjIyMjViNS0wMzE5LTQ3YTMtYWNjMy1jOWJlNDk4MDc1NTIifQ.vQLLzmB7rWkwQDomAuC6Bfm-J0ITsIfFq4wL8UMAAJs",
	"member": {
		"id": 1,
		"email": "js@lvl51.de",
		"firstName": "Julian",
		"surname": "Scheuchenzuber"
	}
}
```

Config
------

[](#config)

Make sure to include an environment variable `JWT_SECRET` and pick a random value.

```
Level51\JWTUtils\JWTUtils:
  secret: '`JWT_SECRET`'          # Secret for signature. This is mandatory and there is no default value
  lifetime_in_days: 7             # Term of validity
  renew_threshold_in_minutes: 60  # Keep JWT for at least 60 minutes
```

API
---

[](#api)

- `static inst()`: Get singleton instance
- `byBasicAuth($request, $includeMemberData: bool = true): array`: Creates a new token from Basic Auth member data
- `renew($token: string): string`: Checks if the given token is valid and needs to be renewed
- `check($token: string): bool`: Checks if token is valid and non-expired

Maintainer
----------

[](#maintainer)

- JZubero

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 68.4% 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 ~513 days

Total

5

Last Release

1020d ago

Major Versions

0.3.0 → 1.0.02023-09-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/441f0e8f95c17048417a33f37e35d5ffdd4c07902cbedaf7f5786f4b7c454284?d=identicon)[JZubero](/maintainers/JZubero)

---

Top Contributors

[![JZubero](https://avatars.githubusercontent.com/u/13751426?v=4)](https://github.com/JZubero "JZubero (13 commits)")[![christohill](https://avatars.githubusercontent.com/u/2646218?v=4)](https://github.com/christohill "christohill (3 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (2 commits)")[![thats4shaw](https://avatars.githubusercontent.com/u/855269?v=4)](https://github.com/thats4shaw "thats4shaw (1 commits)")

---

Tags

jwtjwt-tokenssilverstripesilverstripe-module

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/level51-silverstripe-jwt-utils/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[laravel/nightwatch

The official Laravel Nightwatch package.

36210.1M36](/packages/laravel-nightwatch)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5752.3M18](/packages/directorytree-ldaprecord-laravel)[microsoft/kiota-authentication-phpleague

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

154.1M9](/packages/microsoft-kiota-authentication-phpleague)[firefly-iii/data-importer

Firefly III Data Import Tool.

8045.8k](/packages/firefly-iii-data-importer)

PHPackages © 2026

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