PHPackages                             nylo/laravel-nylo-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. nylo/laravel-nylo-auth

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

nylo/laravel-nylo-auth
======================

Laravel authentication for Nylo apps

v2.1.1(3w ago)51.4k↑20.8%3MITPHPPHP ^8.2CI passing

Since Nov 26Pushed 3w ago1 watchersCompare

[ Source](https://github.com/nylo-core/laravel-nylo-auth)[ Packagist](https://packagist.org/packages/nylo/laravel-nylo-auth)[ Docs](https://github.com/nylo-core/laravel-nylo-auth)[ GitHub Sponsors](https://github.com/agordn52)[ RSS](/packages/nylo-laravel-nylo-auth/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (31)Versions (12)Used By (0)

Mobile App Authentication for Laravel
=====================================

[](#mobile-app-authentication-for-laravel)

This package provides API authentication endpoints for [Nylo](https://nylo.dev) Flutter apps, powered by Laravel Sanctum.

Check out the Flutter package here: [laravel\_auth\_slate](https://pub.dev/packages/laravel_auth_slate)

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel 10, 11, 12, or 13
- Laravel Sanctum
- Your `User` model must use the `HasApiTokens` trait:

```
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
    // ...
}
```

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

[](#installation)

```
composer require nylo/laravel-nylo-auth
```

Publish the config and controllers:

```
php artisan vendor:publish --provider="Nylo\LaravelNyloAuth\LaravelNyloAuthServiceProvider"
```

This publishes:

- `config/laravel-nylo-auth.php`
- `app/Http/Controllers/AuthController.php`
- `app/Http/Controllers/ApiController.php`

API Endpoints
-------------

[](#api-endpoints)

All routes are prefixed with `/app/v1`.

MethodURINameDescriptionPOST`/app/v1/login``nylo.api.v1.login`Login and receive a Sanctum tokenPOST`/app/v1/register``nylo.api.v1.register`Register a new user and receive a tokenPOST`/app/v1/forgot-password``nylo.api.v1.forgot-password`Send a password reset linkGET`/app/v1/user``nylo.api.v1.auth.user`Get the authenticated user (requires Sanctum token)Configuration
-------------

[](#configuration)

```
// config/laravel-nylo-auth.php

return [
    // The Eloquent model used for authentication
    'user_model' => \App\Models\User::class,

    // Rate limiter classes for each route group
    'rate_limits' => [
        'public' => \Nylo\LaravelNyloAuth\RateLimiters\PublicRateLimiter::class,         // 5 req/min by IP
        'authenticated' => \Nylo\LaravelNyloAuth\RateLimiters\AuthenticatedRateLimiter::class, // 60 req/min by user
    ],
];
```

Rate Limiting
-------------

[](#rate-limiting)

Rate limiting is applied to all routes via named Laravel rate limiters:

- **`nylo-public`** — applies to login, register, and forgot-password (default: 5 requests/min per IP)
- **`nylo-auth`** — applies to authenticated routes (default: 60 requests/min per user)

### Custom Rate Limiters

[](#custom-rate-limiters)

Create a class that implements `RateLimiterContract` and update the config:

```
use Nylo\LaravelNyloAuth\Contracts\RateLimiterContract;
use Illuminate\Cache\RateLimiting\Limit;

class MyPublicRateLimiter implements RateLimiterContract
{
    public function configure(): Limit|array
    {
        return Limit::perMinute(10)->by(request()->ip())->response(function () {
            return response()->json(['message' => 'Too many requests'], 429);
        });
    }
}
```

Then in `config/laravel-nylo-auth.php`:

```
'rate_limits' => [
    'public' => \App\RateLimiters\MyPublicRateLimiter::class,
    'authenticated' => \Nylo\LaravelNyloAuth\RateLimiters\AuthenticatedRateLimiter::class,
],
```

Custom Middleware
-----------------

[](#custom-middleware)

You can append your own middleware to the package's route groups via `config/laravel-nylo-auth.php`. Entries are merged *after* the built-in `throttle:*` and `auth:sanctum` middleware, so rate limiting and authentication still run first.

```
'middleware' => [
    'public' => ['locale'],              // login, register, forgot-password
    'authenticated' => ['log.requests'], // authenticated endpoints (e.g. /user)

    // Target individual routes by their full name
    'routes' => [
        'nylo.api.v1.register' => ['captcha'],
        'nylo.api.v1.auth.user' => ['log.user.access'],
    ],
],
```

Use any middleware alias registered in your app or a fully-qualified middleware class name. Per-route middleware runs *after* the built-in and group-level middleware for that route.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Anthony Gordon](https://github.com/agordn52)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance95

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 92.6% 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 ~91 days

Recently: every ~16 days

Total

11

Last Release

23d ago

Major Versions

v1.3.3 → v2.0.02026-03-29

PHP version history (2 changes)v1.0.1PHP ^8.1

v2.0.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![agordn52](https://avatars.githubusercontent.com/u/17294994?v=4)](https://github.com/agordn52 "agordn52 (25 commits)")[![meliani](https://avatars.githubusercontent.com/u/9725185?v=4)](https://github.com/meliani "meliani (1 commits)")[![necro304](https://avatars.githubusercontent.com/u/31376673?v=4)](https://github.com/necro304 "necro304 (1 commits)")

---

Tags

authauthenticationlaravelnylolaravellaravel authentication for Nylonylo

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/nylo-laravel-nylo-auth/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k98.0M1.3k](/packages/spatie-laravel-permission)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[laravel/ai

The official AI SDK for Laravel.

9782.1M161](/packages/laravel-ai)[spatie/laravel-passkeys

Use passkeys in your Laravel app

470755.5k32](/packages/spatie-laravel-passkeys)

PHPackages © 2026

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