Skip to content
Packstub

Account Switcher for Laravel

Switch between accounts in a Laravel app without signing out, safely, in production. Free and open source (MIT).

Features

  • Impersonation: a route and a facade to sign in as a user, a Blade banner with Switch back, rules on your model.
  • Linked accounts: work from a low-privilege account and switch up to admin only when you need it, with the admin password.
  • Developer logins: one-click sign-in buttons for your seeded accounts, only in the environments you allow.
  • Audit trail: every switch logged with who, why and from where, plus events.
  • Security: one session path for every switch, and a written threat model per feature.

Guides

Guide What it covers
Installation Requirements, the install command, the user model, the routes and the Blade components
Impersonation Starting and ending an impersonation, the banner, authorization hooks
Linked accounts Linking, the "Switch to" list, the password rule, a form that switches
Developer logins Login-page buttons for local development and how they are gated
Configuration The config file, the app context and its closures, events, the switch log, the facade, your own context
Security The threat model behind each feature and the guarantees the package makes

At a glance

composer require packstub/account-switcher
php artisan account-switcher:install
// routes/web.php
use Packstub\AccountSwitcher\Facades\AccountSwitcher;

AccountSwitcher::routes();
{{-- resources/views/layouts/app.blade.php --}}
<x-account-switcher::banner />

Requirements

PHP 8.2+, Laravel 12 or 13, a session guard.


These pages are published at packstub.dev/docs/account-switcher from the package's docs/ directory. Spotted a mistake? Open a pull request.