alizharb/laravel-hooks
Laravel Hooks provides a simple action/filter system for Laravel apps, letting you register and run hooks to extend packages and application code without modifying the original source. Ideal for modular, maintainable customizations.
#[DynamicRelation], #[DynamicScope], Hook::model()) let you ship customer-specific or module-specific model behavior without forking core models — a strong argument against a multi-repo/per-tenant fork strategy.@hook('name', 'fallback.view') lets you standardize empty-state and fallback rendering across themes without per-module special-casing — a design-system/product-consistency enabler.laravel-modular discovery + the laravel-themer/modular-js suite lowers cost of a modular monolith vs. microservices — a real architecture bet for a PM weighing operational overhead.Adopt when:
Look elsewhere when:
For executives: This release turns laravel-hooks from a convenience utility into a genuine extensibility platform. It lets us customize and extend product behavior per customer or module without forking core code, which reduces duplication and speeds up bespoke/enterprise deals. The new circuit breaker is the headline risk story: flaky third-party integrations get automatically muted instead of taking down critical paths — meaning we can safely open an extension surface to partners sooner. Net: faster customization velocity, lower maintenance cost, and a controlled blast radius.
For engineering: v1.2.0 delivers runtime Eloquent extension (attributes + fluent Hook::model()), a HasDynamicHooks trait, typed DTO hook payloads, Blade fallbacks with multi-line discovery, and zero-config modular discovery. CI is hardened (Pest on 8.3/8.4, PHPStan L5, Pint), which signals quality discipline. Trade-offs to plan for: dynamic dispatch and runtime metadata caching make debugging less obvious than static code — budget for observability (Pulse/Debugbar snapshots) and enforce typed hook signatures plus documented hook contracts. Adopt incrementally: start with Blade fallbacks and typed hooks, then layer dynamic model extensions behind feature flags, and treat the hook API as a versioned public contract before exposing it externally.
How can I help you explore Laravel packages today?