PHPackages                             mozhuilungdsuo/impersonator - 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. mozhuilungdsuo/impersonator

ActiveLibrary

mozhuilungdsuo/impersonator
===========================

A package to impersonate users

v1.0.2(1y ago)2367↓33.3%MITPHP

Since Feb 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mozhuilungdsuo/Impersonator)[ Packagist](https://packagist.org/packages/mozhuilungdsuo/impersonator)[ Docs](https://github.com/mozhuilungdsuo/impersonator)[ RSS](/packages/mozhuilungdsuo-impersonator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Impersonator Package
====================

[](#impersonator-package)

Introduction
------------

[](#introduction)

The **Impersonator** package allows administrators to impersonate user logins within a Laravel application. This feature is useful for debugging, customer support, and administrative purposes. However, it should be used with caution to avoid security risks.

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

[](#installation)

To install the package, run the following command:

```
composer require mozhuilungdsuo/impersonator
```

Next, publish the package service provider and configuration file:

```
php artisan vendor:publish --provider="Mozhuilungdsuo\Impersonator\ImpersonateServiceProvider"
```

Run the database migrations:

```
php artisan migrate
```

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

[](#configuration)

After publishing, a configuration file named `impersonate.php` will be created in the `config` directory. You can use this file to define allowed and restricted email addresses for impersonation. Also enable or disable the impersonation feature.

```
return [
    'enabled' => false,
    'allowed_emails' => [
        'admin@example.com',
    ],
    'restricted_emails' => [
        'superadmin@example.com',
    ],
];
```

Usage
-----

[](#usage)

### Blade Directives

[](#blade-directives)

#### Impersonation Button

[](#impersonation-button)

Place the following directive in your views to add an impersonation button for a specific user:

```
@impersonateButton($userId)
```

#### Stop Impersonation Button

[](#stop-impersonation-button)

Add the following directive to your layout file to allow users to stop impersonating:

```
@stopImpersonationButton
```

### Customization

[](#customization)

The views for the impersonation buttons can be customized in the `vendor/impersonate` directory. Modify them as needed to fit your application's UI.

Handling Messages
-----------------

[](#handling-messages)

This package returns success and error messages that need to be manually caught and displayed in your views. For example:

```
return redirect()->back()->with('error', 'User not found.');
```

In your Blade template, catch and display messages like this:

```
@if(session('success'))

        {{ session('success') }}

@endif

@if(session('error'))

        {{ session('error') }}

@endif
```

Security Warning ⚠️
-------------------

[](#security-warning-️)

**Use this package with caution.** Impersonating a user grants full access to their account, which can pose serious security and privacy risks. Ensure that only authorized administrators have permission to use this functionality.

Developer
---------

[](#developer)

**Lungdsuo Mozhui**
Email:

License
-------

[](#license)

This package is open-source and available under the MIT License.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance46

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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 ~27 days

Total

3

Last Release

408d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6372fbb59453de0c379e7e99663f75a624f87ae7136dbe57e857452d8e30fc8b?d=identicon)[mozhui](/maintainers/mozhui)

---

Top Contributors

[![mozhuilungdsuo](https://avatars.githubusercontent.com/u/33083654?v=4)](https://github.com/mozhuilungdsuo "mozhuilungdsuo (32 commits)")

---

Tags

impersonatormozhuilungdsuo

### Embed Badge

![Health badge](/badges/mozhuilungdsuo-impersonator/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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