Looking to hire Laravel developers? Try LaraJobs

laravel-hooks maintained by alizharb

Description
A universal extensibility and plugin system for Laravel 12 applications.
Author
Last update
2026/02/07 12:28 (dev-main)
License
Links
Downloads
21

Comments
comments powered by Disqus

Laravel Hooks

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License PHP Stan

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-debugbar integration.
  • 📊 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

🚀 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:

💖 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