Download the PHP package elegantly/laravel-impersonator without Composer
On this page you can find all versions of the php package elegantly/laravel-impersonator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elegantly/laravel-impersonator
More information about elegantly/laravel-impersonator
Files in elegantly/laravel-impersonator
Package laravel-impersonator
Short Description User impersonation for Laravel
License MIT
Homepage https://github.com/elegantengineeringtech/laravel-impersonator
Informations about the package laravel-impersonator
User impersonation for Laravel
Laravel Impersonator provides simple, session-based user impersonation. It remembers the original authenticated user, logs in as another user, and restores the original user when the impersonation ends.
Installation
Install the package with Composer:
The service provider and facade are discovered automatically by Laravel.
Authorization
Implement the Impersonate interface on your user model:
The package registers an impersonate Gate. It prevents self-impersonation and requires both users to approve the relationship through the methods above.
Routes
Add authenticated routes using the provided controller:
Facade
You may also manage impersonation directly. Authorize the target before starting:
take() and leave() return whether the impersonation state changed. Direct facade calls do not authorize automatically, so always call the impersonate Gate before take().
Events
The package dispatches events after each successful transition:
Elegantly\Impersonator\Events\TakeImpersonationElegantly\Impersonator\Events\LeaveImpersonation
Both events expose the original user as $impersonator and the other user as $impersonated:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Quentin Gabriele
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-impersonator with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0