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.
Attaching event hooks using 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' ];
The package requires PHP 5.6 or later.
The recommended way to install this package is through Composer:
$ composer require icanboogie/bind-event
Cloning the repository
The package is available on GitHub, its repository can be cloned with the following command line:
$ git clone https://github.com/ICanBoogie/bind-event.git
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.
The test suite is ran with the
make test command. PHPUnit and
Composer need to be globally available to run the suite. The command
installs dependencies as required. The
make test-coverage command runs test suite and also
creates an HTML coverage report in "build/coverage". The directory can later be cleaned with
make clean command.
The package is continuously tested by Travis CI.
icanboogie/bind-event is licensed under the New BSD License - See the LICENSE file for details.