A simple Laravel component that enables quick login functionality for development environments.
In short, it includes a blade component that you can include in your login view to:
- create new users and automatically log in as the created user, with one click
- select an existing user to log in, with one click
You can install the package via composer:
composer require josegus/laravel-quick-login
You can publish the config file with:
php artisan vendor:publish --tag="quick-login-config"
This will create the config/quick-login.php
file with the following options:
return [
'model' => \App\Models\User::class,
'displayed_attribute' => 'email',
'redirect_to' => env('QUICK_LOGIN_REDIRECT_TO', 'dashboard'),
];
Optionally, you can publish the views using
php artisan vendor:publish --tag="quick-login-views"
The package includes a Blade component that you can use in any view:
<x-josegus::quick-login-form />
The above code will use Laravel's default authentication model (App\Models\User
) and guard (web
).
If your app uses a different guard, pass it as a parameter to the component:
<x-josegus::quick-login-form guard="customer" />
To create new users, the package will use the factory defined in your auth model, so make sure your auth model uses the HasFactory
trait. You can pass an array of factory states that will be applied when the package creates new users:
<x-josegus::quick-login-form
:factory-states="['isForeign', 'withCompany']"
/>
Alternatively, you can pass an array of properties that will be applied when the package creates new users:
<x-josegus::quick-login-form
:model-attributes="['is_foreign' => true, 'company_name' => 'Laravel']"
/>
By default, the user's email is displayed. You can change this in the configuration:
// config/quick-login.php
return [
'displayed_attribute' => 'username',
];
composer test
This package is open-source software licensed under the MIT license.