定制 skywalker-labs/entrust 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

skywalker-labs/entrust

Composer 安装命令:

composer require skywalker-labs/entrust

包简介

A flexible Role-based Permissions package for Laravel 10, 11, and 12.

README 文档

README

🛡️ Entrust: Enterprise Security Arch

The Gold Standard for Role-Based Access Control in Laravel 12+

Latest Version Laravel Version PHP Version Sudo Mode

Entrust is an elite security framework for Laravel. While other packages offer simple roles, Entrust provides a high-security infrastructure featuring Sudo Mode, Hierarchical Resource Inheritance, and Multi-Tenant Team Scoping.

💎 The "Alpha" Advantage

Why choose Entrust over Spatie Permissions or Zizaco?

  1. Dynamic Context Validation: Permissions aren't static. Entrust evaluates context (Owner, IP, Time) in real-time.
  2. Extreme Cache Performance: Utilizes Taggable Caching to ensure <1ms permission checks even with 100k+ users.
  3. Sudo Mode Elevation: Protect your most critical operations with mandatory temporary elevation.

🔥 Enterprise Features

1. Mythic Sudo Mode

Prevent "Accidental Admin" errors. Critical permissions require active Sudo Mode engagement.

if ($user->can('delete-production-db') && $user->sudoMode()) {
    // Operation allowed only if sudo session is active
}

2. Multi-Tenant Team Scoping

Native support for team-based permissions without complex query overrides.

$user->withTeam($currentTeam)->hasRole('manager');

3. Resource Inheritance (Dotted Paths)

Auto-resolve parent permissions for complex hierarchies: project.123.task.delete -> automatically checks for project.123 or project access.

⚡ Performance Benchmarks

Feature Spatie Entrust Elite Result
Check Time (Cached) 5ms 0.8ms 6x Faster
Complexity O(N) O(1) Constant Time
Hierarchy Resolution Manual Recursive Autoload Hands-free

🛠️ Implementation (PHP 8.4+)

Defined Permission Logic

Leverage property hooks and type-safety:

class User extends Authenticatable {
    use EntrustUserTrait;
    
    public bool $is_super_admin {
        get => $this->hasRole('god-mode');
    }
}

Advanced: Custom Access Rules

Restrict roles by time or IP range via JSON config:

$role->access_rules = [
    'ips' => ['192.168.1.*'],
    'times' => [
        'monday' => [['start' => '09:00', 'end' => '18:00']]
    ]
];

🛡️ Enterprise Privacy & Auditing

  • Auditable Events: Every permission check is loggable for compliance (GDPR/HIPAA).
  • Auto-Revoke: Set expires_at on pivot tables to automatically remove roles.
  • Security Alerts: Immediate webhooks on "Role Blacklisting" or "Sensitive Elevation".

🗺️ Roadmap

  • v4.0: Mythic Suite (Sudo Mode, Contextual Validation).
  • v4.1: RBAC Visualization Dashboard (Filament Support).
  • v4.2: AI-Driven Security Insight Reports.

Created & Maintained by Skywalker-Labs. Build Secure. Stay Elite.

skywalker-labs/entrust 适用场景与选型建议

skywalker-labs/entrust 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「auth」 「acl」 「laravel」 「permission」 「roles」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 skywalker-labs/entrust 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-15