Download the PHP package ebrahemalwish/laravel-multi-guard without Composer
On this page you can find all versions of the php package ebrahemalwish/laravel-multi-guard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ebrahemalwish/laravel-multi-guard
More information about ebrahemalwish/laravel-multi-guard
Files in ebrahemalwish/laravel-multi-guard
Package laravel-multi-guard
Short Description A Laravel package to scaffold multiple authentication guards (web, JWT, Passport) with migrations, models, middleware, controllers, routes, seeders, and views.
License MIT
Informations about the package laravel-multi-guard
Laravel Multi Guard 🛡️
A Laravel package that scaffolds multiple authentication guards in seconds — complete with migrations, models, middleware, controllers, routes, seeders, and a beautiful Aurora UI.
What does this package do?
Run one command and answer a few questions. The package will automatically generate every file needed for each authentication guard you define — whether it's a classic web session guard, a JWT API guard, or a Passport API guard.
No more copy-pasting boilerplate across admin, vendor, driver, customer, and however many other guard types your project needs.
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.1 |
| Laravel | ^10.0 | ^11.0 | ^12.0 |
| tymon/jwt-auth (optional, for JWT guards) | ^2.0 |
| laravel/passport (optional, for Passport guards) | ^12.0 |
Installation
Laravel's auto-discovery will register the service provider automatically.
Usage
Build guards
The command will ask:
- How many guards do you want? — enter a number (anything else is rejected with an error).
- Guard name — e.g.
admin,vendor,customer. - Guard type —
weborapi. - (API only) API driver —
jwtorpassport.
Repeat steps 2–4 for each guard, then sit back.
Remove guards
Enter comma-separated guard names, or type all to remove every guard that was generated.
You will be asked to confirm before any files are deleted.
What gets generated per guard?
For every guard (web + api)
| File | Location |
|---|---|
| Migration | database/migrations/YYYY_MM_DD_HHmmss_create_{guard}s_table.php |
| Model | app/Models/{Guard}.php |
| Middleware | app/Http/Middleware/{Guard}AuthMiddleware.php |
| API Resource | app/Http/Resources/{Guard}Resource.php |
| Seeder | database/seeders/{Guard}Seeder.php |
| Route file | routes/{guard}.php |
Web guards only
| File | Location |
|---|---|
| Controller | app/Http/Controllers/{Guard}/{Guard}Controller.php |
| Auth Controller | app/Http/Controllers/{Guard}/Auth/AuthController.php |
| Dashboard view | resources/views/{guard}/dashboard.blade.php |
| Login view | resources/views/{guard}/Auth/login.blade.php |
API guards only
| File | Location |
|---|---|
| Auth Controller (JWT/Passport) | app/Http/Controllers/{Guard}/v1/Auth/AuthController.php |
What gets modified in your project?
| File | What changes |
|---|---|
config/auth.php |
Guard entry + provider entry added |
bootstrap/app.php (Laravel 11+) |
Route groups + middleware aliases added via ->withRouting() and ->withMiddleware() |
app/Http/Kernel.php (Laravel 10) |
$middlewareAliases entries added |
app/Providers/RouteServiceProvider.php (Laravel 10) |
Route groups registered in boot() |
database/seeders/DatabaseSeeder.php |
$this->call(GuardSeeder::class) added |
public/css/style.css |
Aurora UI stylesheet published (skipped if already exists) |
Generated file details
Migration columns
Every guard table gets these columns:
Model
Extends Authenticatable. Includes HasFactory, Notifiable, the correct $guard name, full $fillable, $hidden, and a casts() method.
Middleware
Web guard middleware redirects to the guard's login page when unauthenticated or inactive.
API guard middleware returns JSON 401 responses.
The alias is always {guard}.auth (e.g. admin.auth).
Web routes
API routes
API Resource
Returns all model fields as JSON — useful in login responses and anywhere you need to return a guard's data cleanly.
Seeder
Creates a default user for the guard:
Views (web guards only)
A production-ready Aurora UI kit is published:
public/css/style.css— dark-glass design system (auto-skip if already present).dashboard.blade.php— full dashboard with sidebar, topbar, stat cards, chart, activity feed, table, and progress bars.login.blade.php— login card with email/password validation, error flash, and show/hide password toggle.
After running multi-guard:build
Then visit /{guardName}/login in your browser (web guards) or POST to /api/v1/auth/login-email (API guards).
Middleware alias reference
| Guard name | Alias |
|---|---|
admin |
admin.auth |
vendor |
vendor.auth |
customer |
customer.auth |
| (etc.) | {guard}.auth |
Use in routes like:
Auth config drivers
| Guard type | Driver |
|---|---|
| Web | session |
| API (JWT) | jwt |
| API (Passport) | passport |
License
MIT — free to use in any project, commercial or otherwise.
Contributing
Pull requests welcome. Please open an issue first to discuss what you'd like to change.
Credits
Built with ❤️ by Ebrahem Alwish. Aurora UI design system included.
All versions of laravel-multi-guard with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/filesystem Version ^10.0|^11.0|^12.0