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

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

plopster/jwt-auth
=================

Library for standard jwt validation and generation

v0.0.1(6mo ago)01proprietaryPHP

Since Oct 25Pushed 6mo agoCompare

[ Source](https://github.com/Plopster-Software-Development/jwt-auth-lib)[ Packagist](https://packagist.org/packages/plopster/jwt-auth)[ RSS](/packages/plopster-jwt-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

JWT Auth Library (PHP)
======================

[](#jwt-auth-library-php)

A modular and extensible JWT authentication library built on top of `firebase/php-jwt`.
It provides a clean structure for generating, validating, refreshing, and customizing tokens with support for custom payloads and claim validation.

---

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

[](#installation)

```
composer require yourname/jwt-auth
```

---

Usage Example
-------------

[](#usage-example)

```
use JwtAuth\Config\JwtConfig;
use JwtAuth\Claims\DefaultClaimsProvider;
use JwtAuth\Keys\LocalKeyProvider;
use JwtAuth\Services\TokenGenerator;
use JwtAuth\Services\TokenValidator;
use JwtAuth\Services\TokenRefresher;
use JwtAuth\Validation\DefaultClaimValidator;
use JwtAuth\Core\JwtManager;

$config = new JwtConfig(
    issuer: 'my-app',
    audience: 'my-users',
    algorithm: 'RS256',
    privateKeyPath: __DIR__ . '/keys/private.pem',
    publicKeyPath: __DIR__ . '/keys/public.pem',
    ttl: 3600
);

$keyProvider = new LocalKeyProvider($config->privateKeyPath, $config->publicKeyPath);
$claimsProvider = new DefaultClaimsProvider($config->issuer, $config->audience, $config->ttl);
$claimValidator = new DefaultClaimValidator();

$generator = new TokenGenerator($config, $claimsProvider, $keyProvider);
$validator = new TokenValidator($config, $keyProvider);
$refresher = new TokenRefresher($generator);

$jwtManager = new JwtManager($generator, $validator);

// Generate a token
$token = $jwtManager->createToken(['user_id' => 42]);

// Validate the token
$payload = $jwtManager->verifyToken($token);

// Refresh the token
$newToken = $refresher->refresh($payload);
```

---

Features
--------

[](#features)

- Generate JWT tokens with default or custom claims
- Validate tokens and decode payloads securely
- Refresh tokens using existing payload data
- Extend or replace any component:

    - `ClaimsProviderInterface` for custom payload logic
    - `ClaimValidatorInterface` for custom validation rules
    - `TokenPayloadInterface` for custom payload objects
    - `KeyProviderInterface` for flexible key management (file, env, KMS, etc.)

---

Project Structure
-----------------

[](#project-structure)

```
src/
 ├── Claims/
 ├── Config/
 ├── Contracts/
 ├── Core/
 ├── Exceptions/
 ├── Keys/
 ├── Services/
 └── Validation/

```

Each folder is modular and follows the single-responsibility principle, making the library scalable and easy to maintain.

---

License
-------

[](#license)

Proprietary License.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance66

Regular maintenance activity

Popularity1

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

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

205d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c4ec4db9210ec1d999cef9dc0edb0db5cfc3614f7ee771404dc03db863178c75?d=identicon)[Nicodav28](/maintainers/Nicodav28)

### Embed Badge

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

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

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k272.7M162](/packages/google-auth)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5161.1M3](/packages/robsontenorio-laravel-keycloak-guard)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[wp-graphql/wp-graphql-jwt-authentication

JWT Authentication for WPGraphQL

361118.4k1](/packages/wp-graphql-wp-graphql-jwt-authentication)

PHPackages © 2026

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