icanboogie/bind-event
Binds icanboogie/event to ICanBoogie
Maintainers
Requires
- php: >=7.2
- icanboogie/event: ^4.0
- icanboogie/icanboogie: ^5.0
Requires (Dev)
- phpunit/phpunit: ^8.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
BSD-3-Clause 533485f616cb266f0398369a45bdc65cefe7d70e
- Olivier Laviale <olivier.laviale.woop@gmail.com>
README
👁 Release
👁 Code Coverage
👁 Downloads
The icanboogie/bind-event package binds icanboogie/event to ICanBoogie, using its
Autoconfig feature. It provides a config synthesizer for event hooks defined in event
configuration fragments, and an events getter for Application instances.
<?php namespace ICanBoogie; require 'vendor/autoload.php'; $app = boot(); $app->configs['event']; // obtain the "event" config. $app->events; // obtain an EventCollection instance created with the "event" config.
Installation
composer require icanboogie/bind-event
Attaching event hooks using the event config
The event config can be used to define event hooks.
The following example demonstrates how an application can attach event hooks to be notified when nodes are saved (or nodes subclasses), and when an authentication exception is thrown during the dispatch of a request.
<?php // config/event.php namespace App; use ICanBoogie; use Icybee; $hooks = Hooks::class . '::'; return [ Icybee\Modules\Nodes\SaveOperation::class . '::process' => $hooks . 'on_nodes_save', ICanBoogie\HTTP\AuthenticationRequired::class . '::rescue' => $hooks . 'on_authentication_required_rescue' ];
Continuous Integration
The project is continuously tested by GitHub actions.
👁 Tests
👁 Static Analysis
👁 Code Style
Code of Conduct
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
Contributing
See CONTRIBUTING for details.
