Download the PHP package jonquihote/pluggable without Composer
On this page you can find all versions of the php package jonquihote/pluggable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jonquihote/pluggable
More information about jonquihote/pluggable
Files in jonquihote/pluggable
Package pluggable
Short Description This package allows developers to plug their custom code into Action/Filter hooks, similar to WordPress
License MIT
Homepage https://github.com/jonquihote/pluggable
Informations about the package pluggable
Pluggable
Typed, synchronous WordPress-style actions and filters for Laravel. Pluggable lets packages and application modules react to events or contribute values without depending directly on each other. Dispatch uses the PSR-14 standard through Tukio.
Installation
You can install the package via Composer:
Laravel discovers the package service provider and facade automatically. The package has no configuration, migrations, routes, views, or assets to publish.
Laravel Boost
Pluggable ships a Boost skill that teaches supported AI coding agents how to define, register, dispatch, and inspect actions and filters. After installing this package in an application that uses Laravel Boost, run:
Select the pluggable-development skill when prompted. For a new Boost setup,
php artisan boost:install --skills discovers the skill during installation.
Actions
Actions announce that something happened. Listeners perform side effects while the action object can carry results back to its caller.
Dispatching is synchronous. Every listener finishes before dispatch() returns:
Filters
Filters pass a typed value through listeners. Each listener can replace that value, making filters useful for transformations and cross-module aggregation.
Registering pluggables and listeners
Create one provider for each logical package or application module. $module is
introspection metadata only; it does not affect dispatch.
Register this consumer provider in bootstrap/providers.php:
Listener classes are resolved lazily from Laravel's container, so constructor
injection works normally. A class entry invokes __invoke(); an array entry calls
the named method.
Override bootModuleEvents() when a module needs to bridge native Laravel events
into a pluggable action or filter. Keep framework-owned event subscriptions next
to module's pluggable declarations:
For ad-hoc closure listeners or tests, use the manager directly. Higher priority listeners run first:
Call $action->stopPropagation() or $filter->stopPropagation() to prevent later
listeners from running.
Introspection
List registered actions, filters, and listener counts:
Inspect one pluggable and its listeners:
Registry data is also available through pluggable()->registry() or the
Pluggable facade.
When to use Pluggable
Use actions when one module owns a signal and another owns the reaction. Use filters when several modules contribute to or transform one value. Prefer direct calls or normal Laravel events inside one module. Dispatch is synchronous and in-process; listeners should enqueue jobs when work belongs in the background.
Contributing
Thank you for considering contributing to Pluggable! Please review our contributing guide to get started.
Credits
- Joni Chandra
- All Contributors
License
Pluggable is open-sourced software licensed under the MIT license.