Binds icanboogie/event to ICanBoogie.
The icanboogie/bind-event package binds icanboogie/event to ICanBoogie, using its
Autoconfig feature. It provides a config synthesizer for event hooks defined in
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.
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' ];
The package requires PHP 7.2 or later.
composer require icanboogie/bind-event
The package is documented as part of the ICanBoogie framework documentation. You can
generate the documentation for the package and its dependencies with the
make doc command. The
documentation is generated in the
build/docs directory. ApiGen is required.
The directory can later be cleaned with the
make clean command.
make test-container to create and log into the test container, then run
make test to run the
test suite. Alternatively, run
make test-coverage to run the test suite with test coverage. Open
build/coverage/index.html to see the breakdown of the code coverage.
icanboogie/bind-event is released under the New BSD License.