PHPackages                             pinetco-dev/laravel-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. pinetco-dev/laravel-impersonate

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

pinetco-dev/laravel-impersonate
===============================

Laravel Impersonate - A package that allows for easy and secure user impersonation within a Laravel application.

2.0.0(2y ago)11.2k[4 PRs](https://github.com/pinetco-dev/laravel-impersonate/pulls)MITPHPPHP &gt;=8.1CI passing

Since Apr 21Pushed 1mo agoCompare

[ Source](https://github.com/pinetco-dev/laravel-impersonate)[ Packagist](https://packagist.org/packages/pinetco-dev/laravel-impersonate)[ Docs](https://github.com/pinetco-dev/laravel-impersonate)[ RSS](/packages/pinetco-dev-laravel-impersonate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (13)Versions (7)Used By (0)

Laravel Impersonate
===================

[](#laravel-impersonate)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8bfd3e952d9b8a4fccfa1f3d03c3eb90bca5198c977cd2b26097a5c230eac229/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70696e6574636f2d6465762f6c61726176656c2d696d706572736f6e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pinetco-dev/laravel-impersonate)[![GitHub Tests Action Status](https://camo.githubusercontent.com/78d73217a1483a2f21a08f27b84352faa26bd66829649cfb9e0137cc85c31c6c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f70696e6574636f2d6465762f6c61726176656c2d696d706572736f6e6174652f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/pinetco-dev/laravel-impersonate/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c63f0ed42cdf5d8ea4d47256b9f7e37ae2caedbd99fd727d503ca169cacfac71/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f70696e6574636f2d6465762f6c61726176656c2d696d706572736f6e6174652f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/pinetco-dev/laravel-impersonate/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/8d4d07f97a83c9949d06323a9096111f0e8f19f28affe251dd3cfb04f33a6f16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70696e6574636f2d6465762f6c61726176656c2d696d706572736f6e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pinetco-dev/laravel-impersonate)

Laravel Impersonate is a package that allows you to easily and securely impersonate other users within a Laravel application. This can be particularly useful for debugging problems and generating scenarios after deploying your application to production.

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

[](#installation)

You can install the package via composer:

```
composer require pinetco-dev/laravel-impersonate
```

Once you have installed the package, you can publish and run the migrations with the following command:

```
php artisan vendor:publish --tag="impersonate-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

The package comes with a configuration file that allows you to customize its settings according to your needs. You can publish the configuration file using the following command:

```
php artisan vendor:publish --tag="impersonate-config"
```

After publishing the configuration file, you need to specify the URL where impersonate webhooks should hit your application. To do this, add the following line to your routes file:

```
Route::impersonation();
```

### Middleware

[](#middleware)

If you want to protect specific pages against user impersonation, you can use the impersonate.protect middleware. For example:

```
Router::get('/payment', function() {
    echo "This page cannot be accessed by an impersonator.";
})->middleware('impersonate.protect');
```

### Blade

[](#blade)

There are some blade directives available that allow you to customize the behavior of your application depending on whether the user can impersonate or is being impersonated.

#### When the user can impersonate

[](#when-the-user-can-impersonate)

```
@canImpersonate
    Login as {{ $user->name }}
@endCanImpersonate
```

#### When the user is being impersonated

[](#when-the-user-is-being-impersonated)

```
@impersonating

        Leave impersonation mode

@endImpersonating
```

Testing
-------

[](#testing)

You can run the tests using the following command:

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Pooja Jadav](https://github.com/pinetco-dev)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance59

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

3

Last Release

796d ago

Major Versions

1.1.0 → 2.0.02024-03-07

PHP version history (2 changes)1.0.0PHP ^8.1

1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d7cba373556b6ccf9b2fbc268d30b62a140c945d509e9e38bb159b72441a224?d=identicon)[pinetco-dev](/maintainers/pinetco-dev)

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

---

Top Contributors

[![PoojaJadav](https://avatars.githubusercontent.com/u/56014892?v=4)](https://github.com/PoojaJadav "PoojaJadav (28 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")

---

Tags

laravellaravel impersonatepinetco-dev

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/pinetco-dev-laravel-impersonate/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k89.8M1.0k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[jeffgreco13/filament-breezy

A custom package for Filament with login flow, profile and teams support.

1.0k1.7M41](/packages/jeffgreco13-filament-breezy)[spatie/laravel-login-link

Quickly login to your local environment

4381.2M1](/packages/spatie-laravel-login-link)[ryangjchandler/laravel-cloudflare-turnstile

A simple package to help integrate Cloudflare Turnstile.

438896.6k2](/packages/ryangjchandler-laravel-cloudflare-turnstile)[spatie/laravel-passkeys

Use passkeys in your Laravel app

444494.4k16](/packages/spatie-laravel-passkeys)

PHPackages © 2026

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