PHPackages                             abdurrahmanriyad/lumenauth - 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. abdurrahmanriyad/lumenauth

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

abdurrahmanriyad/lumenauth
==========================

A package to implement easy authentication in lumen

622PHP

Since Jan 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/abdurrahmanriyad/lumenAuth)[ Packagist](https://packagist.org/packages/abdurrahmanriyad/lumenauth)[ RSS](/packages/abdurrahmanriyad-lumenauth/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

lumenAuth
=========

[](#lumenauth)

LumenAuth is a simple authentication package for lumen. This enables user to get rid of primary hassle to setup token based authentication in lumen.

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

[](#installation)

- Install LumenAuth with composer:

```
composer require abdurrahmanriyad/lumenauth
```

- Add the following line to **bootstrap/app.php** file

```
$app->register(\Abdurrahmanriyad\LumenAuth\LumenAuthServiceProvider::class);
```

- Add a secret key(anything you want) to **LUMEN\_AUTH\_SECRET** in **.env** which used to build token

```
LUMEN_AUTH_SECRET=YOUR_SECRET_KEY

eg. LUMEN_AUTH_SECRET=7852ef15dcdd3eaeb40sdfasdf459171556
```

- If your User model doesn't belong to **App\\User** then add the following line on your **.env** file

```
USER_MODEL=YOUR_USER_MODEL_NAMESPACE

eg. USER_MODEL=App\Models\User
```

Usage
-----

[](#usage)

- Add **lumenAuth** middleware to routes you want authentication

For example,

```
$router->group(['middleware' => 'lumenAuth'],
    function () use ($router) {
        //your routes
    });
```

- To generate token for a user you use **LumenAuthFacade::getToken($user)** which return a token for given user instance.

For example,

```
use Abdurrahmanriyad\LumenAuth\Facades\LumenAuthFacade;
.......

class AuthController extends Controller {

   public function login(Request $request) {
        //validate user and check user
        ........

        // Verify the password and generate the token
        if (Hash::check($userPassword, $user->password)) {
            return response()->json([
                'token' => LumenAuthFacade::getToken($user)
            ], 200);
        }

        .........
    }

}
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16055472?v=4)[Abdur Rahman](/maintainers/abdurrahmanriyad)[@abdurrahmanriyad](https://github.com/abdurrahmanriyad)

### Embed Badge

![Health badge](/badges/abdurrahmanriyad-lumenauth/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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