caesardev / laravel-login-command
A Laravel command to login as a user
Fund package maintenance!
CaesarDev
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/caesardev/laravel-login-command
Requires
- php: ^8.0
- illuminate/contracts: ^10.0||^11.0||^12.0
- laravel/framework: ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- spatie/laravel-ray: ^1.35
README
A Laravel package that generates secure, signed login links for authenticating users via the command line. Perfect for development, testing, or providing customer support access.
Installation
You can install the package via composer:
composer require caesardev/laravel-login-command
You can publish the config file with:
php artisan vendor:publish --tag="login-command-config"
This is the contents of the published config file:
return [ 'expiration' => 60, 'guard' => null, 'redirect_url' => '/', 'route_name' => 'login-link', 'user_model' => 'App\\Models\\User', ];
Usage
Generate a signed login link for a user by their ID:
php artisan login:link 1
Or by their email:
php artisan login:link user@example.com
The command will output a signed URL that you can click or copy and paste into your browser to authenticate as that user.
Options
--guard: Specify the authentication guard to use
php artisan login:link 1 --guard=admin
--redirect: Specify where to redirect after login
php artisan login:link 1 --redirect=/dashboard
--expires: Set how many minutes the link remains valid (default: 60)
php artisan login:link 1 --expires=120
Configuration
- expiration: Default number of minutes the login link is valid (default: 60)
- guard: Default authentication guard to use (default: null, uses default guard)
- redirect_url: Default URL to redirect to after login (default: '/')
- route_name: Name of the login route (default: 'login-link')
- user_model: The User model class to use (default: 'App\Models\User')
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.