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

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

triquang/laravel-auth-scaffold
==============================

Scaffold API &amp; Web authentication for any Eloquent model with multi-auth support — monolith or modular Laravel.

2.0.1(8mo ago)010MITPHPPHP ^8.0

Since Aug 1Pushed 8mo agoCompare

[ Source](https://github.com/ntquangkk/laravel-auth-scaffold)[ Packagist](https://packagist.org/packages/triquang/laravel-auth-scaffold)[ RSS](/packages/triquang-laravel-auth-scaffold/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Auth Scaffold
=====================

[](#laravel-auth-scaffold)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4c7883ee991ef79842ba9967b274615141ece0ad99b85bc194e8ce1339a8d70f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7472697175616e672f6c61726176656c2d617574682d73636166666f6c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triquang/laravel-auth-scaffold)[![Total Downloads](https://camo.githubusercontent.com/f68605e94616af7834d52330c3b63f89bc93ad0c09b7c32f201a7a8f0a112b84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7472697175616e672f6c61726176656c2d617574682d73636166666f6c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/triquang/laravel-auth-scaffold)[![License](https://camo.githubusercontent.com/d45b7a30f5a00f61ebfde483b097383934f8215b739a42af462ec4055746b940/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7472697175616e672f6c61726176656c2d617574682d73636166666f6c642e7376673f7374796c653d666c61742d737175617265)](https://github.com/ntquangkk/laravel-auth-scaffold?tab=MIT-1-ov-file)

🚀 Quickly scaffold full Laravel authentication for **any Eloquent model**, supporting **multi-auth** in both **API** and **Web UI** — for monolith or modular apps.

This package accelerates authentication setup for **custom models** like `Admin`, `Client`, `Vendor`, etc., and works seamlessly with both **standard Laravel** and **modular Laravel** architectures (e.g., `nwidart/laravel-modules`).

---

✨ Features
----------

[](#-features)

- ✅ Supports **any Eloquent model** (`User`, `Admin`, `Client`, etc.)
- ✅ Scaffold for both **API routes/controllers/services** and **Web (views/forms)**
- ✅ **Works with modules** — fully compatible with `nwidart/laravel-modules`
- ✅ **Multi-auth ready** — configure multiple guards &amp; providers automatically
- ✅ Generates:
    - Auth-ready Model (or updates existing one)
    - Migrations (with OTP, password reset)
    - Auth controllers (API + optional Web)
    - Requests, Services, Routes, Views (if `--web`)
    - Auth config updates (`guards`, `providers`, `passwords`)
- ✅ One single command does it all

### API functions

[](#api-functions)

- Register
- Login
- Logout
- Forgot Password
- Reset Password
- Verify OTP

### WEB functions

[](#web-functions)

- Includes all API functions above, plus:
    - Show register view
    - Show login view
    - Show Forgot Password view
    - Show Reset Password view
    - Show Verify OTP view

---

📦 Installation
--------------

[](#-installation)

```
composer require triquang/laravel-auth-scaffold --dev
```

### Optional: Publish Stubs

[](#optional-publish-stubs)

```
php artisan vendor:publish --provider="TriQuang\\LaravelAuthScaffold\\LaravelAuthScaffoldServiceProvider" --tag=auth-scaffold-stubs
```

This will publish stubs to:

```
/stubs/vendor/triquang/laravel-auth-scaffold/

```

---

🚀 Usage
-------

[](#-usage)

```
php artisan make:auth-scaffold --model=Admin
```

### Options

[](#options)

OptionDescription`--model`(Required) Name of the model to generate authentication for. Defaults to `User`.`--module`(Optional) Generate files inside `Modules/{ModuleName}`.`--web`(Optional) Include web views and web routes.---

### Examples

[](#examples)

#### 1. Generate basic API auth for default `User` model

[](#1-generate-basic-api-auth-for-default-user-model)

```
php artisan make:auth-scaffold
```

#### 2. Generate API auth for `Admin` model

[](#2-generate-api-auth-for-admin-model)

```
php artisan make:auth-scaffold --model=Admin
```

#### 3. Generate full auth for `Author` model inside a module

[](#3-generate-full-auth-for-author-model-inside-a-module)

```
php artisan make:auth-scaffold --model=Author --module=Blog
```

#### 4. Generate web+API auth for `Client` model

[](#4-generate-webapi-auth-for-client-model)

```
php artisan make:auth-scaffold --model=Client --web
```

---

📂 File Structure Generated
--------------------------

[](#-file-structure-generated)

Example with `--model=Admin`:

```
app/
├── Http/
│   ├── Controllers/
│   │   └── Auth/
│   │       ├── AdminApiAuthController.php
│   │       └── AdminWebAuthController.php  # If --web
│   └── Requests
│       └── Auth
│           ├── AdminForgotPasswordRequest.php
│           ├── AdminLoginRequest.php
│           ├── AdminRegisterRequest.php
│           └── AdminResetPasswordRequest.php
├── Models/
│   └── Admin.php
└── Services/
    └── Auth/
        └── AdminAuthService.php
database/
└── migrations/
    ├── create_admins_table.php
    ├── create_admin_password_reset_tokens_table.php
    └── create_admin_otp_codes_table.php
routes/
├── api.php          # Updated
└── web.php          # If --web
resources/
└── views/
    └── auth/
        ├── admin-login.blade.php
        ├── admin-register.blade.php
        ├── admin-forgot-password.blade.php
        ├── admin-reset-password.blade.php
        └── admin-verify-otp.blade.php
config/
└── auth.php         # Auto-updated for guards/providers/passwords

```

---

🛡 Authentication Compatibility Check
------------------------------------

[](#-authentication-compatibility-check)

- The command will:
    - Check if model extends `Illuminate\Foundation\Auth\User`
    - Check if model has required traits like `HasApiTokens`
    - Insert guidance comments if not

---

🧩 Customization
---------------

[](#-customization)

You can customize the stub files to suit your coding standards:

```
php artisan vendor:publish --tag=auth-scaffold-stubs
```

Edit stubs in:

```
stubs/vendor/triquang/laravel-auth-scaffold/

```

---

🧭 Auto-Generated Code Markers
-----------------------------

[](#-auto-generated-code-markers)

This package adds **clear flags** in generated code to help developers easily find and review them.

### Example

[](#example)

```
    // AUTO-GEN: Placeholder
    public function up()
    {
        Schema::create('admins', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->timestamps();

            // AUTH-SCAFFOLD-MISSING-COLUMNS
            // Required authentication fields missing in 'admins' migration:
            // $table->string('email')->unique();
            // $table->string('password');
            // $table->string('otp')->nullable();
            // $table->timestamp('email_verified_at')->nullable();
            // $table->string('remember_token')->nullable();
            // AUTH-SCAFFOLD-MISSING-COLUMNS
        });
    }
```

### Available Markers

[](#available-markers)

- `// AUTO-GEN-4-AUTH`
- `// AUTO-GEN: Placeholder`
- `// AUTH-SCAFFOLD-MISSING-COLUMNS`

You can quickly search these markers (`Ctrl/Cmd+Shift+F`) to locate auto-generated code and **remove them after review**.

---

❓ Why use this package?
-----------------------

[](#-why-use-this-package)

Compared to Laravel Breeze, Jetstream or Fortify:

- ✅ Supports **any number of auth models** (not just `User`)
- ✅ Works in both **standard** and **modular** architectures
- ✅ Auth flow is fully generated and flexible for customizing
- ✅ Designed for **fast scaffolding** with clean, extensible code

---

💡 Example Use Cases
-------------------

[](#-example-use-cases)

- Build multi separate auths for User, Admin, Vendor... in one app
- Use in modular apps like Modules/User, Modules/Admin
- Rapid implementing for auth APIs
- Auto-generate secure &amp; clean Laravel auth structure

---

🚫 Limitations
-------------

[](#-limitations)

- Does not include frontend assets like Vue/React.
- For OTP/email verification, you need to configure mail/notification system.

---

✅ Requirements
--------------

[](#-requirements)

- PHP &gt;= 8.0
- Laravel 11 / 12
- Composer
- Optional: `Laravel Sanctum`
- Optional: `nwidart/laravel-modules`

---

📄 License
---------

[](#-license)

MIT © [Nguyễn Trí Quang](mailto:ntquangkk@gmail.com)

---

🙌 Contributing
--------------

[](#-contributing)

PRs are welcome! Feel free to improve functionality or report issues via GitHub Issues.

---

📬 Contact
---------

[](#-contact)

- GitHub: [github.com/ntquangkk](https://github.com/ntquangkk)
- Email:

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance59

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Total

3

Last Release

261d ago

Major Versions

1.0.0 → 2.0.02025-08-20

### Community

Maintainers

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

---

Top Contributors

[![ntquangkk](https://avatars.githubusercontent.com/u/45850915?v=4)](https://github.com/ntquangkk "ntquangkk (9 commits)")

---

Tags

laravelAuthenticationgeneratormoduledddmodularapi-authmulti-authauth-scaffoldweb-auth

### Embed Badge

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

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[olssonm/l5-very-basic-auth

Laravel stateless HTTP basic auth without the need for a database

1662.5M1](/packages/olssonm-l5-very-basic-auth)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2011.0k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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