PHPackages                             lasso-media/cake-impersonate - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. lasso-media/cake-impersonate

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

lasso-media/cake-impersonate
============================

Impersonate plugin for CakePHP 4

3.0.0(7y ago)013MITPHPPHP &gt;5.6

Since Oct 29Pushed 5y agoCompare

[ Source](https://github.com/lasso-media/cake-impersonate)[ Packagist](https://packagist.org/packages/lasso-media/cake-impersonate)[ RSS](/packages/lasso-media-cake-impersonate/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (12)Used By (0)

Cake Impersonate Plugin
=======================

[](#cake-impersonate-plugin)

Impersonate Component
=====================

[](#impersonate-component)

A component that stores the current authentication session and creates new session for impersonating Users. User can revert back to original authentication sessions without the need to re-login.

Warning
-------

[](#warning)

Always double check that an attacker cannot "spoof" other users in the controller actions. To prevent hijacking of users accounts that the current request User shouldn't/wouldn't have normal access to. You should enable [CsfrComponent](https://book.cakephp.org/3.0/en/controllers/components/csrf.html) and [SecurityComponent](https://book.cakephp.org/3.0/en/controllers/components/security.html) in your Controller when loading this component.

***This Plugin does circumvent default authentication mechanisms***

Requirement
-----------

[](#requirement)

1. CakePHP 4.x

Installation/Upgrading
----------------------

[](#installationupgrading)

`composer require lasso-media/cake-impersonate:"^3.0"`

### Plugin Load

[](#plugin-load)

Open \\src\\Application.php add

```
$this->addPlugin('CakeImpersonate');
```

to your bootstrap() method or call `bin/cake plugin load CakeImpersonate`

### Component Load

[](#component-load)

Load the component from controller

```
$this->loadComponent('CakeImpersonate.Impersonate');
```

### Configure Session Key

[](#configure-session-key)

Open `configure\app.php` and add

```
'Impersonate' => [
    'sessionKey' => 'OriginalAuth'
]
```

to the `return [];` or use `Configure::write('Impersonate.sessionKey', 'OriginalAuth');` when loading the component.

Usage
-----

[](#usage)

### Impersonate user

[](#impersonate-user)

This requires the request to be a `POST`, `PUT`, `DELETE` so it can be protected by `SecurityComponent` and `CsrfComponent`

```
$this->Impersonate->login($userIdToImpersonate);
```

### Check current user is impersonated

[](#check-current-user-is-impersonated)

```
$this->Impersonate->isImpersonated();
```

### Logout from impersonating

[](#logout-from-impersonating)

```
$this->Impersonate->logout();
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 61.7% 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 ~45 days

Recently: every ~4 days

Total

11

Last Release

2668d ago

Major Versions

v1.1 → 2.02018-11-22

2.1.6 → 3.0.0-RC12019-01-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/1845d6594befee550a6f08057b1005816894cf86dcacdec70e4d9252b9d1c91c?d=identicon)[lassomedia](/maintainers/lassomedia)

---

Top Contributors

[![challgren](https://avatars.githubusercontent.com/u/88909?v=4)](https://github.com/challgren "challgren (50 commits)")[![JacobAGTyler](https://avatars.githubusercontent.com/u/3827053?v=4)](https://github.com/JacobAGTyler "JacobAGTyler (16 commits)")[![akutaktau](https://avatars.githubusercontent.com/u/408417?v=4)](https://github.com/akutaktau "akutaktau (11 commits)")[![lasso-media](https://avatars.githubusercontent.com/u/67146758?v=4)](https://github.com/lasso-media "lasso-media (4 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lasso-media-cake-impersonate/health.svg)

```
[![Health](https://phpackages.com/badges/lasso-media-cake-impersonate/health.svg)](https://phpackages.com/packages/lasso-media-cake-impersonate)
```

###  Alternatives

[cakedc/users

Users Plugin for CakePHP

524897.0k16](/packages/cakedc-users)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)[admad/cakephp-jwt-auth

CakePHP plugin for authenticating using JSON Web Tokens

160680.3k8](/packages/admad-cakephp-jwt-auth)[markstory/acl_extras

Additional tools for managing DB ACL in CakePHP applications.

155311.0k](/packages/markstory-acl-extras)[admad/cakephp-social-auth

A CakePHP plugin which allows you to authenticate using social providers like Facebook/Google/Twitter etc.

51298.3k1](/packages/admad-cakephp-social-auth)[cakedc/auth

Auth objects for CakePHP

31630.0k2](/packages/cakedc-auth)

PHPackages © 2026

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