Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Impersonate

Impersonate Laravel Package

bpocallaghan/impersonate

Laravel package that lets administrators impersonate other users, so you can see the app exactly as they do. Quickly start and stop impersonation sessions, troubleshoot support issues, and verify permissions without needing anyone's credentials.

View on GitHub
Deep Wiki
Context7

bpocallaghan/impersonate lets administrators log in as any other user in a Laravel application, making it easy to reproduce bugs or see the app exactly as a customer does. A simple /impersonate/{user} route switches the authenticated session to the target user, while /impersonate/leave restores the original account.

  • One-click switching between users via built-in routes
  • Safe return to the admin account stored in session
  • Guard-aware — works with custom auth guards
  • Blade helpers to show/hide impersonation links
  • Configurable middleware and redirect behaviour
Frequently asked questions about Impersonate
How do I install the bpocallaghan/impersonate package in Laravel?
Install the package with Composer using composer require bpocallaghan/impersonate. Then follow the README for any service provider registration, config publishing, or middleware setup required by your Laravel version. Review the package routes and configuration before enabling impersonation in your application.
How does user impersonation work in this Laravel package?
Authorized admins can authenticate as another application user without knowing that user's password. The package provides a switch-back flow so the original admin account can be restored after debugging or support work. Middleware, configurable routes, Blade helpers, and events help integrate the switching behavior into existing Laravel apps.
Can I control who is allowed to impersonate other users?
Yes, the package is described as permission-controlled user impersonation. You should combine its middleware and configuration with your application's own gates or policies to decide which admins can impersonate. Check the README for the supported authorization hooks before relying on it in production.
How do I switch back to my original admin account after impersonating a user?
The package is designed to let admins log in as another user and then switch back to their original account. Use the provided switch-back route, middleware flow, or Blade helper rather than manually logging out. The README should list the exact route names and helper usage for leaving impersonation.
Does this package support Blade helpers for impersonation buttons?
Yes, the package blurb mentions Blade helpers for integrating user switching cleanly into your templates. You can use these helpers to conditionally render impersonate and switch-back controls based on the current user and permissions. Review the README for exact helper names and arguments.
What middleware and routes does bpocallaghan/impersonate provide?
The package includes middleware and configurable routes for managing impersonation access and switching. Routes can be configured to fit your application's URL structure and authentication guards. Check the published configuration and README for default route names and middleware stacks.
Which Laravel versions are supported by bpocallaghan/impersonate?
Supported Laravel versions depend on the specific package release and its Composer constraints. Check the package composer.json and README for the current Illuminate and Laravel version requirements. For older or newer Laravel applications, verify compatibility or look for a maintained fork.
Can I test impersonation flows in my Laravel application?
You can test impersonation by using the package routes and middleware in Laravel feature tests, asserting that authorized users can switch and unauthorized users cannot. The package events can also help you assert that impersonation started or stopped. Confirm exact event names and payloads in the README before writing assertions.
What alternatives exist for Laravel user impersonation?
Alternatives include other Laravel impersonation packages, Laravel Nova impersonation features if you use Nova, or a custom authentication-switching implementation. Evaluate middleware, permission checks, event support, and maintenance activity before choosing. This package is a good fit when you want permission-controlled switching with routes and Blade helpers.
Is bpocallaghan/impersonate actively maintained and safe for production?
Check the GitHub repository for recent commits, open issues, tagged releases, and Composer version constraints before using it in production. Review the authorization middleware and permission checks to ensure only trusted admins can impersonate users. Also test the switch-back flow and any event or audit logging integration in your own application.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core