PHPackages                             henrymanyonyi/laravel-impersonation - 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. henrymanyonyi/laravel-impersonation

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

henrymanyonyi/laravel-impersonation
===================================

Allows admin users to log in as client accounts securely. This package is designed to work seamlessly with Laravel Jetstream and Livewire stacks.

v1.1.0(4mo ago)043↓94.7%MITPHPPHP ^8.1

Since Apr 1Pushed 4mo agoCompare

[ Source](https://github.com/henrymanyonyi/laravel-impersonation)[ Packagist](https://packagist.org/packages/henrymanyonyi/laravel-impersonation)[ RSS](/packages/henrymanyonyi-laravel-impersonation/feed)WikiDiscussions main Synced 6d ago

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

Laravel Impersonation (Jetstream + Livewire Compatible)
=======================================================

[](#laravel-impersonation-jetstream--livewire-compatible)

Allows admin users to log in as client accounts securely. This package is designed to work seamlessly with **Laravel Jetstream** and **Livewire** stacks.

---

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

[](#installation)

You can install the package via composer:

```
composer require henrymanyonyi/laravel-impersonation
```

### 1. Publish and Run Migrations

[](#1-publish-and-run-migrations)

The package requires a way to track impersonation states. Publish and run the migrations with:

```
php artisan vendor:publish --tag=impersonation-migrations
php artisan migrate
```

### 2. Prepare the User Model

[](#2-prepare-the-user-model)

Add the `ImpersonatesUsers` trait to your `User` model. This provides the necessary logic to handle the session swapping.

```
use Henrymanyonyi\Impersonation\Traits\ImpersonatesUsers;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use ImpersonatesUsers;
}
```

---

Usage
-----

[](#usage)

### Start Impersonation

[](#start-impersonation)

To login as a specific user, add a form pointing to the impersonation start route. You should typically wrap this in an `@can` or admin middleware check.

```

    @csrf

        Login as user

```

### Stop Impersonation

[](#stop-impersonation)

When an admin is impersonating a user, you should display a banner or button to allow them to return to their original account.

```
@if(session()->has('impersonator_id'))

        You are currently logged in as {{ auth()->user()->name }}

            @csrf
            Return to admin

@endif
```

---

Security
--------

[](#security)

By default, this package includes middleware to ensure only authorized users can initiate an impersonation session. Ensure your admin logic is properly defined in your `AuthServiceProvider` or via the package configuration.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.# laravel-impersonation

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance75

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

136d ago

### Community

Maintainers

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

---

Top Contributors

[![henrymanyonyi](https://avatars.githubusercontent.com/u/49695523?v=4)](https://github.com/henrymanyonyi "henrymanyonyi (6 commits)")

### Embed Badge

![Health badge](/badges/henrymanyonyi-laravel-impersonation/health.svg)

```
[![Health](https://phpackages.com/badges/henrymanyonyi-laravel-impersonation/health.svg)](https://phpackages.com/packages/henrymanyonyi-laravel-impersonation)
```

###  Alternatives

[illuminate/auth

The Illuminate Auth package.

9328.5M1.3k](/packages/illuminate-auth)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6796.8k7](/packages/hasinhayder-tyro)[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2508.1k7](/packages/hasinhayder-tyro-login)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2115.6k](/packages/alajusticia-laravel-logins)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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