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

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

nckg/laravel-impersonate
========================

Easily impersonate any user in a Laravel Application

4.0.1(5y ago)1132.8k↓22.4%1MITPHPPHP ^7.2|^8.0

Since Feb 14Pushed 5y ago2 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (7)Used By (0)

Impersonate
===========

[](#impersonate)

[![Build Status](https://camo.githubusercontent.com/bf3800e568f99a1709961883afe8a8c122b9770b14f43bbb61e85fd4825a0d24/68747470733a2f2f7472617669732d63692e6f72672f6e636b672f6c61726176656c2d696d706572736f6e6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nckg/laravel-impersonate) [![Packagist](https://camo.githubusercontent.com/ec6177d1c2798a4b0894aa6996bf4e6022bf9f9c243e98387bca44dfb3e45fb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e636b672f6c61726176656c2d696d706572736f6e6174652e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://github.com/nckg/laravel-impersonate) [![Packagist](https://camo.githubusercontent.com/8620c14c42b1ff3e5d15ba322fa9f9b70ef43738a19ec55952b2999a2b5cc66b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e636b672f6c61726176656c2d696d706572736f6e6174652e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](https://github.com/nckg/laravel-impersonate)

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

[](#introduction)

Easily impersonate any user in your Laravel Application

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

[](#installation)

You can install the package via composer:

```
composer require nckg/laravel-impersonate
```

Add following code to your user model:

```
    class User
    {
        use \Nckg\Impersonate\Traits\CanImpersonate;
    }
```

Add following code to your routes file:

```
    Route::get('users/{id}/impersonate', function ($id) {
        \Auth::user()->setImpersonating($id);
        return redirect()->back();
    });
    Route::get('users/stop-impersonate', function () {
        \Auth::user()->stopImpersonating();
        return redirect()->back();
    });
```

If you are using Laravel you can add the middleware to your middleware providers

```
// app/Http/Kernel.php
/**
 * The application's global HTTP middleware stack.
 *
 * @var array
 */
protected $middleware = [
    ...
    \Nckg\Impersonate\Impersonate::class,
];
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

Established project with proven stability

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

Total

5

Last Release

1853d ago

Major Versions

1.0.0 → 2.0.02019-03-14

2.0.0 → 3.0.02020-03-13

3.0.0 → 4.0.02021-01-29

PHP version history (2 changes)2.0.0PHP ^7.2

4.0.1PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/360602?v=4)[Nick Goris](/maintainers/nckg)[@nckg](https://github.com/nckg)

---

Top Contributors

[![nckg](https://avatars.githubusercontent.com/u/360602?v=4)](https://github.com/nckg "nckg (12 commits)")

---

Tags

impersonatelaravellaravel-applicationmiddlewarephp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[beatswitch/lock

A flexible, driver based Acl package for PHP 5.4+

870304.7k2](/packages/beatswitch-lock)[amocrm/amocrm-api-library

amoCRM API Client

182728.5k6](/packages/amocrm-amocrm-api-library)[vonage/jwt

A standalone package for creating JWTs for Vonage APIs

424.1M4](/packages/vonage-jwt)

PHPackages © 2026

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