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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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:

  1. How many guards do you want? — enter a number (anything else is rejected with an error).
  2. Guard name — e.g. admin, vendor, customer.
  3. Guard type — web or api.
  4. (API only) API driver — jwt or passport.

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:


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

PHP Build Version
Package Version
Requires php Version ^8.1
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ebrahemalwish/laravel-multi-guard contains the following files

Loading the files please wait ...