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

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

nicoaudy/impersonate
====================

Laravel impersonate middleware, simply traits for impersonating other user

0138PHP

Since Jan 16Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-impersonate)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c6f5f2fbf5781c511f88da453ffb7ffa7b4707524aaadf931ae61963ca79a154/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e69636f617564792f696d706572736f6e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nicoaudy/impersonate)[![Total Downloads](https://camo.githubusercontent.com/ce2c4a1fd5f55a1d5926e5e23adb67050f22a0b7d4a68a0563b2fd090e48db86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e69636f617564792f696d706572736f6e6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nicoaudy/impersonate)

Simple package that do the trick, Impersonate makes it easy to authenticate as your users. Add a simple trait to your user model and impersonate as one of your users in one click.

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

[](#installation)

Via Composer

```
$ composer require nicoaudy/impersonate
```

Add traits to your user model

```
// User.php

use NicoAudy\Impersonate\Traits\Impersonate;

class User extends Authenticatable
{
    use Notifiable, Impersonate;

    // Other stuff
}
```

Register Middleware to route

```
Route::middleware('impersonate')->group(function(){
     // your routes can be impersonates
});
```

Usage
-----

[](#usage)

Impersonate a user :

```
Auth::user()->setImpersonating($other_user_id);
```

Stop impersonating :

```
Auth::user()->stopImpersonating();
```

Check if current user impersonating :

```
Auth::user()->isImpersonating();
```

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [NicoAudy](https://github.com/nicoaudy)

License
-------

[](#license)

license. Please see the [license file](license.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9941c23ad97bc5b3f5d7051f784b6feb09c8b0a82668d3f715bab119422ce077?d=identicon)[NicoAudy](/maintainers/NicoAudy)

---

Top Contributors

[![nicoaudy](https://avatars.githubusercontent.com/u/9676457?v=4)](https://github.com/nicoaudy "nicoaudy (5 commits)")

### Embed Badge

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

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[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)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

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

PHPackages © 2026

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