PHPackages                             christhompsontldr/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. christhompsontldr/impersonate

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

christhompsontldr/impersonate
=============================

Allows a user to impersonate another user.

v2.0.0(5y ago)0469PHP

Since Dec 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ChrisThompsonTLDR/impersonate)[ Packagist](https://packagist.org/packages/christhompsontldr/impersonate)[ RSS](/packages/christhompsontldr-impersonate/feed)WikiDiscussions 2.x Synced 4w ago

READMEChangelog (1)DependenciesVersions (10)Used By (0)

This Laravel package allows a user to impersonate another user.

Installation
------------

[](#installation)

### Composer

[](#composer)

Require this package with composer:

```
composer require christhompsontldr/impersonate

```

### Model

[](#model)

Update your user model to be impersonatable.

```
namespace App\Models;

use Christhompsontldr\Impersonate\Models\Traits\Impersonatable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Impersonatable;

```

Access Control
--------------

[](#access-control)

You must complete this step, or none of your users will have permission to impersonate.

The authorized users that can impersonate and which users they can impersonate is controlled via the trait. This can be overloaded on your user model

In this example, the user model has an `is_admin` attribute that is being checked.

```
public function canImpersonate(User $user)
{
    return $this->is_admin ?: false;
}

```

Or if you are using [Laratrust](https://github.com/santigarcor/laratrust)

```
public function canImpersonate(User $user)
{
    // can't impersonate other admins
    if ($user->hasRole('admin')) {
        return false;
    }

    // current user is admin
    return $this->hasRole('admin');
}

```

Issues
------

[](#issues)

Logout will be performed on both the main user and the impersonated user.

Source
------

[](#source)

This package is based on [this example](http://blog.mauriziobonani.com/easily-impersonate-any-user-in-a-laravel-application/).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~176 days

Recently: every ~293 days

Total

9

Last Release

2086d ago

Major Versions

0.0.4 → v1.0.02017-07-27

v1.0.2 → v2.0.02020-10-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/bdadda5dda1f5a9711517509d5e552a699cd17fdac70fcc0ce7d364697d9cf0f?d=identicon)[ChrisThompsonTLDR](/maintainers/ChrisThompsonTLDR)

---

Top Contributors

[![ChrisThompsonTLDR](https://avatars.githubusercontent.com/u/348801?v=4)](https://github.com/ChrisThompsonTLDR "ChrisThompsonTLDR (24 commits)")[![taylornotwell](https://avatars.githubusercontent.com/u/78162749?v=4)](https://github.com/taylornotwell "taylornotwell (3 commits)")

---

Tags

laravelUser management

### Embed Badge

![Health badge](/badges/christhompsontldr-impersonate/health.svg)

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

###  Alternatives

[tomatophp/filament-users

Manage your users with a highly customizable user resource for FilamentPHP with integration of filament-shield and filament-impersonate

90117.5k8](/packages/tomatophp-filament-users)[offload-project/laravel-invite-only

A Laravel package for managing user invitations with polymorphic relationships, token-based access, scheduled reminders, and event-driven notifications.

729.3k2](/packages/offload-project-laravel-invite-only)[ingria/laravel-x509-auth

Laravel 5 Client Certificate auth middleware

375.6k](/packages/ingria-laravel-x509-auth)

PHPackages © 2026

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