abdullyahuza/filament-impersonate 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

abdullyahuza/filament-impersonate

Composer 安装命令:

composer require abdullyahuza/filament-impersonate

包简介

Filament Impersonate allows administrators to securely impersonate other users within the Filament admin panel. With a simple "Impersonate" action, admins can log in as another user to troubleshoot issues, test permissions, or preview user-specific content. A visible banner indicates impersonation m

README 文档

README

DEMO UI

🎭 Filament Impersonate

License: MIT

A plugin for Filament Admin Panel that allows authorized users to impersonate other users.

📦 Installation

composer require abdullyahuza/filament-impersonate

Optionally publish the config file:

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

⚙️ Configuration

Inside config/filament-impersonate.php:

return [

    'redirect_after_impersonation' => 'filament.app.pages.dashboard',

    'guard' => 'web',

    'user_model' => \App\Models\User::class,

    'session_key' => 'filament_impersonator_id',

    'excluded_user_ids' => [/* user IDs that should never be impersonated */],

    'allowed_environments' => ['local', 'staging', 'production'],

    'display_name_resolver' => fn ($user) => $user->name ?? 'Unknown User',

    'can_impersonate_resolver' => fn ($user) => $user?->hasRole('admin') || $user?->can('impersonate users'),

];

Setup Filament-Impersonate

Install for Panel

->plugins([
	...
	FilamentImpersonate::make(),
])
->middleware([
	...
	// AuthenticateSession::class,
])

✅ Usage

Impersonate a user

  1. From the Filament UI, click the impersonation button shown next to user profile (if allowed).
  2. You will be logged in as that user.
  3. A banner or button will appear indicating impersonation — click it to stop impersonating.

Stop impersonating

Click the "Stop Impersonating" button to return to your original user session.

🔐 Permissions

To restrict who can impersonate users, configure the can_impersonate_resolver in your config file.

Example:

'can_impersonate_resolver' => fn ($user) => $user?->hasRole('admin') || $user?->can('impersonate_users'),

💾 Session Management

During impersonation, the following is stored in the session:

  • Impersonator ID
  • Original user roles & permissions (if applicable)

These are restored when impersonation is stopped.

🛡️ Notes

  • Only users not in excluded_user_ids can be impersonated.
  • Impersonation only works in environments defined in allowed_environments.
  • You can customize how user names are displayed using display_name_resolver.

🧪 Testing

Ensure your environment is included in allowed_environments for local testing.

'allowed_environments' => ['local'],

📄 License

The MIT License (MIT). Please see License File for more information.

abdullyahuza/filament-impersonate 适用场景与选型建议

abdullyahuza/filament-impersonate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 abdullyahuza/filament-impersonate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 abdullyahuza/filament-impersonate 我们能提供哪些服务?
定制开发 / 二次开发

基于 abdullyahuza/filament-impersonate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 38
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-21