| Package Data | |
|---|---|
| Maintainer Username: | nckg |
| Maintainer Contact: | nickgoris@gmail.com (Nick Goris) |
| Package Create Date: | 2016-10-28 |
| Package Last Update: | 2021-04-21 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-26 03:17:33 |
| Package Statistics | |
|---|---|
| Total Downloads: | 30,542 |
| Monthly Downloads: | 261 |
| Daily Downloads: | 1 |
| Total Stars: | 11 |
| Total Watchers: | 2 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
Easily impersonate any user in your Laravel Application
You can install the package via composer:
composer require nckg/laravel-impersonate
Add following code to your user model:
class User
{
use \Nckg\Impersonate\Traits\CanImpersonate;
}
Add following code to your routes file:
Route::get('users/{id}/impersonate', function ($id) {
\Auth::user()->setImpersonating($id);
return redirect()->back();
});
Route::get('users/stop-impersonate', function () {
\Auth::user()->stopImpersonating();
return redirect()->back();
});
If you are using Laravel you can add the middleware to your middleware providers
// app/Http/Kernel.php
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
...
\Nckg\Impersonate\Impersonate::class,
];
composer test
The MIT License (MIT).