skywalker-labs/impersonate

A powerful Laravel package to authenticate as your users. Easily impersonate other users in your application with a simple trait. Includes features like Blade directives, event handling, multi-guard support, and customizable access controls for advanced user management and debugging.

Fund package maintenance!
ermradulsharma

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/skywalker-labs/impersonate

v1.0.0 2026-02-15 07:10 UTC

This package is auto-updated.

Last update: 2026-02-15 08:52:33 UTC


README

🎭 Laravel Impersonate: Pro Stealth

Switch Users with Elite Precision and Zero-Config UI Injection

Latest Version Laravel Version PHP Version UI Status

Laravel Impersonate Pro is the ultimate developer tool for troubleshooting user issues. It allows you to step into your users' shoes without knowing their passwords, while maintaining absolute security and a seamless audit trail.

✨ Why Pro Impersonate?

Most impersonation packages are "dumb"—they just swap session IDs. Our Elite Architect approach ensures:

  • 🤫 Quiet Auth: Impersonate without triggering "Login" events or updating last_login_at (Optional).
  • 🍪 Persistent Persona: Remembers your admin state even if the impersonated user's session expires.
  • 💉 Auto-UI Injection: A sleek, non-intrusive floating bar appears only during impersonation.
  • 🛡️ TTL Guards: Set a time-to-live for impersonation sessions to prevent "Forgot to Leave" security leaks.

🔥 Killer Features

1. Multi-Guard Support

Seamlessly switch between web, admin, or custom guards without losing context.

2. Blade Directives for Elite DX

@impersonating
    <div class="alert alert-warning">
        You are currently viewing as <strong>{{ Auth::user()->name }}</strong>.
        <a href="{{ route('impersonate.leave') }}">Return to Admin</a>
    </div>
@endImpersonating

3. Integrated Audit Logging

Never guess who did what. Our package logs every impersonation cycle with ID, IP, and timestamps.

⚡ Performance & Security

Feature Industry Standard Skywalker Elite
Logic Conflict High (Session overriding) Low (Stealth Session Separation)
UI Setup Manual Views Zero-Config Injection
Security Simple Guard Check Multi-factor Gate Protection

🛠️ Elite Implementation (PHP 8.4+)

Take Control

Start impersonation with high-level API:

public function loginAs(User $user): bool 
{
    return impersonate()->take(
        from: auth()->user(), 
        to: $user,
        guardName: 'web'
    );
}

Global Middleware Protection

// app/Http/Kernel.php
protected $middlewareGroups = [
    'web' => [
        \Skywalker\Impersonate\Middleware\ProtectFromImpersonation::class,
    ],
];

🛡️ Enterprise Privacy

  • Encrypted Session Keys: Impersonation tokens are salted and rotated.
  • Event-Driven Hooks: Fire internal webhooks when a support agent starts an impersonation session.
  • Auto-Cleanup: Automatically clears impersonation data on master logout.

Created & Maintained by Skywalker-Labs. Built for Developers, Trusted by Admins.