alizharb/laravel-hooks
Composer 安装命令:
composer require alizharb/laravel-hooks
包简介
A universal extensibility and plugin system for Laravel 12 applications.
README 文档
README
Laravel Hooks is a production-ready, universal extensibility system for Laravel 12. Inspired by WordPress but modernized with PHP 8.5 attributes, Strict Typing, and Deep Laravel Integration.
✨ Features
- ⚡ Actions & Filters: High-performance hook system (
addAction,applyFilters). - 🧬 Model Extensions: Declarative model extensions via Attributes or
Hook::model()API. - 🛡️ Type-Safe: Strict signatures contracts,
BackedEnum, and DTO support. - 🚦 Circuit Breaker: request-level failure protection for critical hooks.
- 🚀 Async & Queued: Dispatch heavy actions to Laravel Queue via
Hook::queueAction. - 🔍 Inspector & Debugbar: Real-time profiling with
laravel-debugbarintegration. - 📊 Pulse Integration: Performance monitoring and hit counts via Laravel Pulse.
- 📦 Ecosystem Ready: Pipelines, Deprecations, IDE Help, and Auto-Docs generator.
📦 Installation
composer require alizharb/laravel-hooks
📚 Documentation
- Basics: Actions, Filters, Priorities, and Attributes.
- Advanced Features: Typed Hooks, Wildcards, Scopes, Pipelines.
- Async & Queue: Background processing.
- Ecosystem & Safe DX: Signatures, Deprecations, IDE Helper, Compilation.
- Integrations: Debugbar, Eloquent, Blade.
- CLI Tooling: Artisan commands.
🚀 Quick Start
Basic Usage
use AlizHarb\LaravelHooks\Facades\Hook; // Register Hook::addAction('order.created', function ($order) { Log::info("Order #{$order->id} created"); }); // Dispatch Hook::doAction('order.created', $order);
Attribute Registration
use AlizHarb\LaravelHooks\Attributes\HookFilter; class contentModifier { #[HookFilter('content.render', priority: 20)] public function addSignature($content) { return $content . "\n\n-- Sent via Laravel Hooks"; } }
🧪 Testing
Run the test suite:
composer test
🌏 Ecosystem
Laravel Hooks is part of a larger ecosystem designed for modular, extensible Laravel applications:
- Laravel Modular: Build modular Laravel apps with zero configuration.
- Laravel Themer: A powerful theme engine for Laravel applications.
- Filament Modular Luncher: The ultimate dashboard launcher for modular projects.
- Filament Themer Luncher: Professional theme switching for Filament.
- Modular JS: Seamless asset management for Laravel modules.
- First-class bridges for Filament and Livewire.
💖 Sponsors
If you find this package useful, please consider supporting its development:
📄 License
The MIT License (MIT). Please see License File for more information.
Made with ❤️ by Ali Harb
alizharb/laravel-hooks 适用场景与选型建议
alizharb/laravel-hooks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 7, 最近一次更新时间为 2026 年 01 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「events」 「laravel」 「filters」 「hooks」 「actions」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alizharb/laravel-hooks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alizharb/laravel-hooks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alizharb/laravel-hooks 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Библиотека для реализаций паттерна Pub/Sub
Wireless Cross-Component Communication
A powerful event calendar Tool for Laravel's Nova 5.
Command bus implementation: Commands and domain events
This is an Event Emitter equivalent to Node.js' Event Emitter.
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 6
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-15