lafourchette/switch-user-stateless-bundle
A Symfony bundle for stateless user switching. Impersonate or switch between users without relying on session state, making it useful for debugging, testing, and admin tooling that integrates with Symfony's security system.
switch_user firewall listener assumes session state. This bundle is aimed at stateless, token-based APIs (JWT/OAuth), where "become this user" means minting or exchanging a token rather than mutating a session. That distinction is itself a product/architecture decision worth naming explicitly in a design doc.Auth::loginUsingId() behind a guarded route, or an existing impersonation package. Treat the mismatch as a hard stop, not a detail.switch_user covers this with zero new dependencies.composer.json constraints (Symfony 2/3/4-era). Confirm it installs against your Symfony and PHP versions before it appears in any plan.To executives: Impersonation is a support-efficiency lever — agents resolving issues in minutes instead of round-tripping with the customer, plus faster QA coverage of role-based flows. The risk is that it is a privileged backdoor into customer accounts, so any implementation must ship with audit trails, short-lived scoped credentials, and a documented policy. The specific package in front of us is a small, unmaintained open-source bundle with no visible adoption; we should not take a dependency on it. We should adopt the pattern, which is a small, well-understood piece of engineering, and own it.
To engineering: This bundle is a reference design for stateless impersonation on Symfony — an admin-authenticated request produces a user-scoped token instead of a session swap. Two caveats: it's Symfony-only (not applicable if the service in question is Laravel), and it has zero stars, zero dependents, and no maintenance signal, so it is a specification, not a dependency. Recommend we implement an equivalent authenticator in-house — mint a short-TTL token carrying both the acting admin and the subject user, enforce scope checks at the firewall, and emit an audit event on issuance and use. Budget is small; the security review is the long pole, not the code.
How can I help you explore Laravel packages today?