PHPackages                             unvurn/reauth - 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. unvurn/reauth

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

unvurn/reauth
=============

Reauth - Yet another authentication module for Laravel

0.1.1(1y ago)01.3kMITPHPPHP ^8.2

Since Jul 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/unvurn/reauth)[ Packagist](https://packagist.org/packages/unvurn/reauth)[ RSS](/packages/unvurn-reauth/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Reauth
======

[](#reauth)

This package provides token-based authentication ability to your laravel-based api server.

Install
-------

[](#install)

```
$ composer require unvurn/reauth
```

And migration files to be generated.

```
$ php artisan vendor:publish --tag=reauth-migrations
```

Configuration
-------------

[](#configuration)

### Guards

[](#guards)

```
# config/auth.php
return [
    'guard' => 'bearer',

    'guards' => [
        # this 'bearer' entry is implied within reauth package itself.
        # you don't have to duplicate it.
        'bearer' => [
            'driver' => 'bearer',
            'pipelines' => [
                [
                    'resolver' => OpaqueAccessTokenResolver::class,
                    'users' => AccessTokenUserProvider::class
                ]
            ]
        ],
        'json' => [
            'driver' => 'json',
            'pipelines' => [
                'custom_id' => [
                    'resolver' => function ($value, &$decoded) {
                        $decoded = $value;
                        return [ 'custom_id' => $value ];
                    },
                    // 'users': can be omitted
                ]
            ],
        ]
    ]
];
```

Reauth package provides new form of `Guard`. Guard has two attributes - 'driver' and 'pipelines'.

'Driver' attribute assigns token source per each http requests. 'Bearer' driver requires that each http request has a bearer token carried by "Authorization" header. it means that each request should contain header like this:

```
Authorization: Bearer (token string)
```

'Json' driver requires that json request body contains specified attribute, such as "custom\_id" in the example above.

### Pipelines

[](#pipelines)

Guard has one or more pipelines to pass the result of authentication from token to trailing processes such as Controller. Each pipeline is processed in order, finishes when authenticated user picked up (and later ones are abandoned).

#### Resolver

[](#resolver)

Resolver has role for decoding of raw token string (or pass through if it is "opaque" token) and arrange it into "credentials" for `UserProvider::retrieveByCredentials()` usage.

There are two ways to configure resolver how it works. The first one is to use class instance that implements `TokenResolverInterface`, like this.

```
            'pipelines' => [
                [
                    'resolver' => OpaqueAccessTokenResolver::class,
                    // ...
                ]
            ]
```

This class `OpaqueAccessTokenResolver` fulfills `TokenResolverInterface` i.e. `credentialsFromToken` method.

The other one is anonymous function like this:

```
            'pipelines' => [
                [
                    'resolver' => function ($value, &$decoded) {
                        $decoded = $value;
                        return [ 'custom_id' => $value ];
                    },
                ]
            ]
```

The signature of this anonymous function is similar with `TokenResolverInterface::credentialsFromToken()`.

Warning

If you don't care decoded token in trailing process (ex. Controller) you can omit and ignore the second parameter like this,

```
                  'resolver' => function ($value) {
                      return [ 'custom_id' => $value ];
                  },
```

although it is NOT recommended.

Resolver works for these processes:

- if the input token has certain encoding, encrypting, format and so on, resolver can decompose raw token string into appropriate structure.
- (if necessary) check the token if it is available or not - expiration limit, ownership of token, source address, etc.
- arrange the information of token into "credentials" - for `UserProvider` use.

#### Users (= UserProvider)

[](#users--userprovider)

Users(`UserProvider`) has role for User search that matches with credentials derived from previous processes. `UserProvider` is similar with ordinary ones defined in Laravel Auth. "Reauth" package provides additional functionality using User-related model classes.

- AccessTokenUserProvider
- AttributionalUserProvider
- OpenIdUserProvider

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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 ~70 days

Total

2

Last Release

631d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19956734?v=4)[hironobu koura](/maintainers/hironobu)[@hironobu](https://github.com/hironobu)

---

Top Contributors

[![hironobu](https://avatars.githubusercontent.com/u/19956734?v=4)](https://github.com/hironobu "hironobu (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/unvurn-reauth/health.svg)

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

###  Alternatives

[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M218](/packages/laravel-octane)

PHPackages © 2026

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