PHPackages                             bigz/switch-user-stateless-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. bigz/switch-user-stateless-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

bigz/switch-user-stateless-bundle
=================================

Bundle to use impersonating on Symfony API

0.2.2(5y ago)011.4k↓17.6%2MITPHPPHP &gt;=5.5

Since Jun 22Pushed 5y agoCompare

[ Source](https://github.com/BigZ/SwitchUserStatelessBundle)[ Packagist](https://packagist.org/packages/bigz/switch-user-stateless-bundle)[ RSS](/packages/bigz-switch-user-stateless-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (6)Used By (0)

SwitchUserStatelessBundle
-------------------------

[](#switchuserstatelessbundle)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e68d7a4fb4689a23ee76d8cc191dba4bd651ad959737433be956c7904a7ddce9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61666f75726368657474652f5377697463685573657253746174656c65737342756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lafourchette/SwitchUserStatelessBundle/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3f09c2bc76cf0a94e085f25e38fb6d62ce7d6729704970d98ff89f652b525ce3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61666f75726368657474652f5377697463685573657253746174656c65737342756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lafourchette/SwitchUserStatelessBundle/?branch=master)[![Build Status](https://camo.githubusercontent.com/b3a4cb53f01c0694f13530ee83a71ae79cd7c0e1f1dd7e2351a025b551d96444/68747470733a2f2f7472617669732d63692e6f72672f6c61666f75726368657474652f5377697463685573657253746174656c65737342756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lafourchette/SwitchUserStatelessBundle)[![Dependency Status](https://camo.githubusercontent.com/789caae96b83add8fbb5b0edfd0b4360ba38a26ac2508066698979b9611b0a37/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537313061393235666364313961303033396631373033302f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/5710a925fcd19a0039f17030)[![SensioLabsInsight](https://camo.githubusercontent.com/99410042adcbbfc4e5cf80624991e58568bcb528d30b5cb0ec16f1b88dfbfa25/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f66623935653339662d303961352d346333652d613030342d6337623933613862643732352f6d696e692e706e67)](https://insight.sensiolabs.com/projects/fb95e39f-09a5-4c3e-a004-c7b93a8bd725)

This bundle provides impersonating feature (switch user) for API use.

Install
-------

[](#install)

Install this bundle through [Composer](https://getcomposer.org/):

```
composer require lafourchette/switch-user-stateless-bundle

```

Then, update your application kernel:

```
// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new LaFourchette\SwitchUserStatelessBundle\SwitchUserStatelessBundle(),
        ];

        // ...
    }
}
```

Finally, update your firewalls as following:

```
# app/config/security.yml

security:
    firewalls:
        main:
            # ...
            stateless: true
            switch_user_stateless: true
```

Configuration
-------------

[](#configuration)

You can configure the parameter used in HTTP request and role of user who switch in your config.yml. The examples below are the default values.

```
# app/config/config.yml

switch_user_stateless:
    parameter: 'X-Switch-User'
    role: 'ROLE_ALLOWED_TO_SWITCH'
```

Usage
-----

[](#usage)

To use this feature, you need to add a `X-Switch-User` header to issued HTTP request containing the username of the user you want to switch:

```
X-Switch-User: johndoe

```

For security reasons, this feature is only accessible for users with `ROLE_ALLOWED_TO_SWITCH` permission. Admin users have this permission by default.

Troubleshooting
---------------

[](#troubleshooting)

[Solving problems here](https://github.com/lafourchette/SwitchUserStatelessBundle/tree/master/doc/troubleshooting.md)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~497 days

Total

4

Last Release

2125d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42766?v=4)[Romain Richard](/maintainers/bigz)[@BigZ](https://github.com/BigZ)

---

Top Contributors

[![vincentchalamon](https://avatars.githubusercontent.com/u/407859?v=4)](https://github.com/vincentchalamon "vincentchalamon (21 commits)")[![BigZ](https://avatars.githubusercontent.com/u/42766?v=4)](https://github.com/BigZ "BigZ (5 commits)")[![dunglas](https://avatars.githubusercontent.com/u/57224?v=4)](https://github.com/dunglas "dunglas (4 commits)")[![jshedde](https://avatars.githubusercontent.com/u/6703514?v=4)](https://github.com/jshedde "jshedde (4 commits)")[![toofff](https://avatars.githubusercontent.com/u/966550?v=4)](https://github.com/toofff "toofff (3 commits)")

---

Tags

apirestImpersonating

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bigz-switch-user-stateless-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bigz-switch-user-stateless-bundle/health.svg)](https://phpackages.com/packages/bigz-switch-user-stateless-bundle)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[lexik/jwt-authentication-bundle

This bundle provides JWT authentication for your Symfony REST API

2.6k58.7M210](/packages/lexik-jwt-authentication-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
