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(3mo ago)043↓90%MITPHPPHP ^8.1

Since Apr 1Pushed 3mo 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 4w 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

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

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

91d 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

[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

84611.1M60](/packages/php-open-source-saver-jwt-auth)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M125](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M123](/packages/roots-acorn)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[hasinhayder/tyro

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

6783.6k5](/packages/hasinhayder-tyro)[alajusticia/laravel-logins

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

2013.2k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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