PHPackages                             bpocallaghan/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. bpocallaghan/impersonate

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

bpocallaghan/impersonate
========================

Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

1.5.1(3mo ago)814.4k↓50%33MITPHPPHP &gt;=8.3.0

Since Jun 27Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/bpocallaghan/impersonate)[ Packagist](https://packagist.org/packages/bpocallaghan/impersonate)[ RSS](/packages/bpocallaghan-impersonate/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (3)

Impersonation (Laravel Authentication)
======================================

[](#impersonation-laravel-authentication)

Laravel 5 package to enable impersonation. Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.

See it in action at a [Laravel Admin Starter](https://github.com/bpocallaghan/laravel-admin-starter) project.

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

[](#installation)

Update your project's `composer.json` file.

```
composer require bpocallaghan/impersonate --dev

```

`Laravel app->environment() == 'local') {
        $this->app->register(\Bpocallaghan\Impersonate\ImpersonateServiceProvider::class);
    }
}
```

Usage
-----

[](#usage)

`impersonate()->login($user)` Impersonate the given user and save the currently logged in user in session.
`impersonate()->logout()` Logout the impersonated user and log the original user back in.
`impersonate()->isActive()` If the logged in user is currently being impersonated by another user.

You can register your own routes. For example you want to change the endpoints or update the middlewares, etc. If you need to do additional validation, register your own Controller and only use the above methods. You can create your own view file to handle the login / logout functionality. The view file included is mostly for reference.

### Config

[](#config)

`register_routes` If the package will register the routes or if you rather prefer to add your own.
`session` The session keys that will be used. Save original user and if currently impersonating a user.

#### Publish Assets (optional)

[](#publish-assets-optional)

Publish the config and view file.

```
php artisan vendor:publish --provider="Bpocallaghan\Impersonate\ImpersonateServiceProvider" --tag=view
php artisan vendor:publish --provider="Bpocallaghan\Impersonate\ImpersonateServiceProvider" --tag=config

```

In your view forms to login or logout. You can add a hidden input with name `'redirect_to'` to specify the return redirect to url after login / logout.

Disclaimer
----------

[](#disclaimer)

Please use the package with caution. By using this package, you agree that the contributors of this package cannot be held responsible for any damages caused by using this package.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance82

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

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

Total

5

Last Release

97d ago

Major Versions

0.1.0 → 1.0.02017-09-20

PHP version history (4 changes)0.1.0PHP &gt;=5.6.4

1.0.0PHP &gt;=7.0.0

1.1.0PHP &gt;=7.3.0

1.5PHP &gt;=8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7cc52fc6eaeee1d7cbb729f7b7e7fb570754f4d2bb57847e5753f4e1041b7124?d=identicon)[bpocallaghan](/maintainers/bpocallaghan)

---

Top Contributors

[![bpocallaghan](https://avatars.githubusercontent.com/u/883465?v=4)](https://github.com/bpocallaghan "bpocallaghan (8 commits)")

---

Tags

impersonateimpersonationlaravellaravelimpersonationimpersonatedevelopmentUserslogin-as

### Embed Badge

![Health badge](/badges/bpocallaghan-impersonate/health.svg)

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[franbarbalopez/mirror

Mirror is a Laravel package that handles user impersonation.

1548.1k](/packages/franbarbalopez-mirror)[rickycezar/laravel-jwt-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

24117.6k](/packages/rickycezar-laravel-jwt-impersonate)[tomatophp/filament-users

Manage your users with a highly customizable user resource for FilamentPHP with integration of filament-shield and filament-impersonate

90102.0k7](/packages/tomatophp-filament-users)[hapidjus/laravel-impersonate-ui

UI for 404labfr/laravel-impersonate

371.5k](/packages/hapidjus-laravel-impersonate-ui)[arcanedev/laravel-auth

Laravel Authorization package.

294.8k1](/packages/arcanedev-laravel-auth)

PHPackages © 2026

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