LaraPersonate is a new package by @supianIdz that allows you to log in as a different user quickly. This impersonation package is inspired by viacreative/sudo-su (which is not active) and still has some planned work to be done such as unit tests, UI improvements, and supporting role-based features.
The project’s listed features at the time of writing include:
- Ability to limit the number of users displayed
- Search form using tail.select
- Auto discovery, no more setting up your ServiceProvider manually.
- Automatic injection via a middleware, no need to add code to blade templates
When using a package that provides impersonation abilities, you need to be aware of the security threat if misused. I’d advise you to become familiar with the package’s source code and read the readme warning:
This package can pose a serious security issue if misused, as anybody will be able to take control of any user’s account. Please ensure that the service provider is only registered when the app is in a debug/local environment.
This package picks up where viacreative/sudo-su left off, so feel free to check with the author of the package to see if any opportunities exist to support the project with features, bug fixes, etc.
Another popular alternative in the community is 404labfr/laravel-impersonate, and I think it’s nice to see more of this type of package surface in the Laravel community.
You can learn more about this package, get full installation instructions, and view the source code on GitHub at SupianIDz/LaraPersonate.