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

ActiveLibrary

viktorf/jwt
===========

Laravel/Symfony JWT authorization service

1.0.5(5y ago)0108MITPHPCI failing

Since Jul 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/va-fursenko/jwt)[ Packagist](https://packagist.org/packages/viktorf/jwt)[ RSS](/packages/viktorf-jwt/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (6)Used By (0)

jwt
===

[](#jwt)

Simple Laravel/Symfony JWT authorization service

See

installation
------------

[](#installation)

```
composer require viktorf/jwt
```

For Laravel just add `JWT\JWTServiceProvider` to proper section of `config/app.php` or register it in `AppServiceProvider.php`and then use `AuthenticateWithJWT` middleware. After `JWTServiceProvider` registration you can publish vendor config:

```
php artisan vendor:publish --provider="JWT\JWTServiceProvider" --tag="config"
```

All classes in `JWT\Service` can be extended to expand their logic. For example, you can replace `JWTReceiver` &amp; `JWTService` in middleware constructor with their descendants using DI.

using
-----

[](#using)

```
$secret = 'some jwt secret';
$token  = 'some jwt token';
$service = new \JWT\Service\JWTService($secret);

// Callback is not mandatory, you can just skip it in authenticate() call
$callback = function (JWT\Service\JWTHeader $header, JWT\Service\JWTPayload $payload)
{
    if (empty($payload->customField)) {
        throw new \JWT\Exception\JWTException("JWT token is invalid: \$payload->customField is needed");
    }
    log("JWT custom field retrieved: " . $payload->customField);
};

try {
    $this->jwtService->authenticate($token, $callback);
} catch (JWT\Exception\JWTException $exception) {
    throw new HttpException('Access denied', 403, $exception);
} catch (Throwable $error) {
    throw new HttpException('Internal server error', 500, $error);
}
```

extending
---------

[](#extending)

```
class ExtraJWTPayload extends \JWT\Service\JWTPayload
{
    public string $customField = '';

    public function isValid() : bool
    {
        if (empty($this->customField)) {
            return false;
        }
        return true;
    }
}

class ExtraJWTService extends \JWT\Service\JWTService
{
    protected function getPayloadClass() : string
    {
        return ExtraJWTPayload::class;
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Every ~0 days

Total

5

Last Release

2128d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8af391bd0f89fbb636f49456dbfb5994d09bd7b1c3a0dd0b889d498a997d6a9c?d=identicon)[va-fursenko](/maintainers/va-fursenko)

---

Top Contributors

[![va-fursenko](https://avatars.githubusercontent.com/u/16989618?v=4)](https://github.com/va-fursenko "va-fursenko (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.5k9.4M48](/packages/laravel-reverb)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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