alizharb/laravel-hooks

A universal extensibility and plugin system for Laravel 12 applications.

Fund package maintenance!
AlizHarb

Installs: 15

Dependents: 0

Suggesters: 6

Security: 0

Stars: 7

Watchers: 0

Forks: 1

Open Issues: 0

pkg:composer/alizharb/laravel-hooks

v1.2.0 2026-01-31 20:30 UTC

This package is auto-updated.

Last update: 2026-01-31 20:37:29 UTC


README

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