Download the PHP package quix-labs/laravel-hook-system without Composer
On this page you can find all versions of the php package quix-labs/laravel-hook-system. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quix-labs/laravel-hook-system
More information about quix-labs/laravel-hook-system
Files in quix-labs/laravel-hook-system
Package laravel-hook-system
Short Description Add hooks system to Laravel
License MIT
Informations about the package laravel-hook-system
Laravel Hook System
The quix-labs/laravel-hook-system
package provides a hook system for Laravel.
This system allows intercepting and manipulating specific actions in your application.
Requirements
- PHP >= 8.1
- Laravel 10.x|11.x|12.x
Installation
You can install this package via Composer:
Hook usage
Creating a Hook
A hook is a class that extends QuixLabs\LaravelHookSystem\Hook
:
Creating a Fully Cacheable Hook
Fully cacheable hooks execute interceptors during cache generation and prevent their execution at runtime. An interceptor can bypass this behavior.
Registering Hooks
In the register
method of your ServiceProvider:
Executing a Hook
To execute a hook, QuixLabs\LaravelHookSystem\Hook
implements the static send
method:
Interceptor usage
Creating an Interceptor
An interceptor is a class with a static method intercepted via an #[Intercept]
attribute:
Registering Interceptors
In the boot
method of your ServiceProvider:
Artisan Commands
The package adds three Artisan commands to manage the hooks:
hooks:status
: Displays the status of hooks and interceptors.hooks:cache
: Caches the hooks and interceptors.hooks:clear
: Clears the hooks and interceptors cache.
Planned Features
The following features are planned for future implementation:
- Instantiate interceptor class using
app()
(add support for dependency container injection).
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- COLANT Alan
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-hook-system with dependencies
illuminate/support Version ^10.0 || ^11.0 || ^12.0
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0
illuminate/console Version ^10.0 || ^11.0 || ^12.0