PHPackages                             authaction/authaction-php-sdk - 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. authaction/authaction-php-sdk

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

authaction/authaction-php-sdk
=============================

AuthAction JWT verification SDK for PHP — Laravel, PSR-15, plain PHP

v0.1.0(1mo ago)08MITPHPPHP &gt;=8.1CI passing

Since Jun 4Pushed 1mo agoCompare

[ Source](https://github.com/authaction/authaction-php-sdk)[ Packagist](https://packagist.org/packages/authaction/authaction-php-sdk)[ RSS](/packages/authaction-authaction-php-sdk/feed)WikiDiscussions main Synced 1w ago

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

authaction-php-sdk
==================

[](#authaction-php-sdk)

AuthAction JWT verification SDK for PHP 8.1+. Works with **Laravel**, **PSR-15** frameworks (Slim, Mezzio), and plain PHP.

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

[](#installation)

```
composer require authaction/authaction-php-sdk
```

Quick start
-----------

[](#quick-start)

```
use AuthAction\AuthAction;

$aa = new AuthAction(
    domain:   $_ENV['AUTHACTION_DOMAIN'],
    audience: $_ENV['AUTHACTION_AUDIENCE'],
);

// Verify a raw token — throws TokenExpiredException / TokenInvalidException on failure
$payload = $aa->verifyToken($token);
echo $payload->sub;

// Verify from Authorization header — returns null on missing/invalid
$payload = $aa->verifyRequest($_SERVER['HTTP_AUTHORIZATION'] ?? null);
```

Laravel
-------

[](#laravel)

```
// bootstrap/app.php
->withMiddleware(function (Middleware $middleware) {
    $middleware->alias(['auth.jwt' => \AuthAction\Middleware\LaravelMiddleware::class]);
})

// routes/api.php
Route::middleware('auth.jwt')->get('/me', function (Request $request) {
    $user = $request->get('authaction.user');
    return ['sub' => $user->sub];
});
```

Register `AuthAction` as a singleton in a ServiceProvider:

```
$this->app->singleton(AuthAction::class, fn () =>
    new AuthAction(config('authaction.domain'), config('authaction.audience'))
);
```

PSR-15 (Slim, Mezzio)
---------------------

[](#psr-15-slim-mezzio)

```
use AuthAction\Middleware\PsrMiddleware;
use Slim\Factory\AppFactory;

$app = AppFactory::create();
$app->add(new PsrMiddleware($verifier, $responseFactory));

$app->get('/protected', function (Request $request, Response $response) {
    $user = $request->getAttribute('authaction.user');
    $response->getBody()->write(json_encode(['sub' => $user->sub]));
    return $response;
});
```

Exceptions
----------

[](#exceptions)

```
use AuthAction\Exception\TokenExpiredException;
use AuthAction\Exception\TokenInvalidException;

try {
    $payload = $aa->verifyToken($token);
} catch (TokenExpiredException $e) {
    http_response_code(401);
    echo json_encode(['error' => 'Token has expired']);
} catch (TokenInvalidException $e) {
    http_response_code(401);
    echo json_encode(['error' => $e->getMessage()]);
}
```

Environment variables
---------------------

[](#environment-variables)

```
AUTHACTION_DOMAIN=your-tenant.eu.authaction.com
AUTHACTION_AUDIENCE=https://api.your-app.com
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1304f9467df2d8d647bc7649e9a59e325bd541667006c2538fedcf896dd21248?d=identicon)[chandhravadanan](/maintainers/chandhravadanan)

---

Top Contributors

[![chandhravadanan](https://avatars.githubusercontent.com/u/26822664?v=4)](https://github.com/chandhravadanan "chandhravadanan (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/authaction-authaction-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/authaction-authaction-php-sdk/health.svg)](https://phpackages.com/packages/authaction-authaction-php-sdk)
```

###  Alternatives

[google/auth

Google Auth Library for PHP

1.4k294.2M224](/packages/google-auth)[thenetworg/oauth2-azure

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

25310.7M85](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

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

2276.4M46](/packages/stevenmaguire-oauth2-keycloak)[robsontenorio/laravel-keycloak-guard

🔑 Simple Keycloak Guard for Laravel

5181.2M3](/packages/robsontenorio-laravel-keycloak-guard)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

121256.9k1](/packages/ellaisys-aws-cognito)[rainlab/user-plugin

User plugin for October CMS

11955.0k15](/packages/rainlab-user-plugin)

PHPackages © 2026

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