PHPackages                             genealabs/laravel-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. genealabs/laravel-impersonator

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

genealabs/laravel-impersonator
==============================

Impersonate users in your Laravel and Nova apps.

13.0.0(3mo ago)62275.2k↓72.6%7MITPHPPHP ^8.2CI failing

Since May 9Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/mikebronner/laravel-impersonator)[ Packagist](https://packagist.org/packages/genealabs/laravel-impersonator)[ RSS](/packages/genealabs-laravel-impersonator/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (26)Versions (31)Used By (0)

[![Laravel Package](https://github.com/GeneaLabs/laravel-impersonator/workflows/Laravel%20Package/badge.svg?branch=master)](https://github.com/GeneaLabs/laravel-impersonator/workflows/Laravel%20Package/badge.svg?branch=master)[![codecov](https://camo.githubusercontent.com/ec9b662cdc52a238349c1f906329a74342074b4b67a80f7a93ec1d068aa99f1d/68747470733a2f2f636f6465636f762e696f2f67682f47656e65614c6162732f6c61726176656c2d696d706572736f6e61746f722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/GeneaLabs/laravel-impersonator)

Impersonator for Laravel
========================

[](#impersonator-for-laravel)

[![Impersonator for Laravel masthead image.](https://repository-images.githubusercontent.com/90768538/6b44c600-f29c-11e9-88af-65e839679460)](https://repository-images.githubusercontent.com/90768538/6b44c600-f29c-11e9-88af-65e839679460)

Supporting This Package
-----------------------

[](#supporting-this-package)

This is an MIT-licensed open source project with its ongoing development made possible by the support of the community. If you'd like to support this, and our other packages, please consider [becoming a backer or sponsor on Patreon](https://www.patreon.com/mikebronner).

Pre-requisites
--------------

[](#pre-requisites)

- Laravel 10.0+
- PHP 8.2+

Version Support Matrix
----------------------

[](#version-support-matrix)

LaravelPHP10.x8.2, 8.3, 8.4, 8.511.x8.2, 8.3, 8.4, 8.512.x8.2, 8.3, 8.4, 8.513.x8.3, 8.4, 8.5Installation
------------

[](#installation)

```
composer require genealabs/laravel-impersonator
```

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

[](#configuration)

- `genealabs-laravel-impersonator.layout`: master blade layout view for your application (default `layouts.app`).
- `genealabs-laravel-impersonator.content-section`: name of content section in master layout blade view (default `content`).
- `genealabs-laravel-impersonator.user-model`: user model of your application (default `config('auth.providers.users.model')`).
- `genealabs-laravel-impersonator.middleware`: the middleware to use for the impersonatee routes (default: `['web', 'auth']`). You may specify `only` or `except` parameters. E.g. `['web', 'auth', 'password.confirm' => ['except' => 'destroy']]`

If you need to customize these settings:

```
php artisan impersonator:publish --config
```

Usage
-----

[](#usage)

1. Add trait `GeneaLabs\LaravelImpersonator\Traits\Impersonatable` to your user model.
2. Override trait method `public function getCanImpersonateAttribute() : bool` that determines if a given user can impersonate other users.
3. (optional) Override trait method `public function getCanBeImpersonatedAttribute() : bool` that determines if a given user can be impersonated.
4. Use `route('impersonatees.index')` to view a list of all impersonatable users. You could add something like the following to your menu:

```
@if ((auth()->user()->canImpersonate ?? false) && ! session('impersonator'))
    Impersonator
@endif
```

5. (optional) Add something like the following to your menu view to allow imporsonator to stop impersonating:

```
@if (session('impersonator'))

        End Impersonation Session

        {{ csrf_field () }}
        {{ method_field ('DELETE') }}

@else

        Logout

        {{ csrf_field () }}

@endif
```

Customization
-------------

[](#customization)

```
php artisan impersonator:publish --views
```

Credits
-------

[](#credits)

In large part prodded and inspired by LaraCasts' tutorial: . Thank you @JeffreyWay!

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance82

Actively maintained with recent releases

Popularity48

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.3% 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 ~129 days

Recently: every ~505 days

Total

26

Last Release

97d ago

Major Versions

1.0.1 → 7.0.02020-02-29

7.0.2 → 8.0.02020-09-15

8.0.1 → 9.02022-02-22

9.0 → 10.0.02023-05-20

10.0.0 → 13.0.02026-03-29

PHP version history (3 changes)0.1.0PHP &gt;=7.0.0

0.2.4PHP &gt;=7.1.3

13.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4374bfc5d8583aa8c25c5080f1fcfaf09027822f47724ba6b64abc564945c80a?d=identicon)[mikebronner](/maintainers/mikebronner)

---

Top Contributors

[![mikebronner](https://avatars.githubusercontent.com/u/1791050?v=4)](https://github.com/mikebronner "mikebronner (97 commits)")[![herroworrd](https://avatars.githubusercontent.com/u/47008367?v=4)](https://github.com/herroworrd "herroworrd (3 commits)")[![Keoghan](https://avatars.githubusercontent.com/u/6714599?v=4)](https://github.com/Keoghan "Keoghan (3 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

---

Tags

composer-packageimpersonationlaravel

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/pulse

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

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

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M147](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

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