Recommend this page to a friend! |
Download |
Info | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 44 | All time: 10,814 This week: 40 |
Version | License | PHP version | Categories | |||
event-router-php 1.0 | MIT/X Consortium ... | 7.4 | Algorithms, Libraries, Language, PHP 7 |
Description | Author | |
This package can register event handlers and dispatch events. |
Router for flexible configuring of event handling behaviors.
composer require smoren/event-router
composer install
composer test-init
composer test
use Smoren\EventRouter\Components\EventRouter;
use Smoren\EventRouter\Interfaces\EventInterface;
use Smoren\EventRouter\Events\Event;
use Smoren\EventRouter\Structs\EventConfig;
use Smoren\EventRouter\Loggers\ArrayLogger;
$router = new EventRouter(10, new ArrayLogger());
$router
->on(new EventConfig('origin1'), function(EventInterface $event) {
return null;
})
->on(new EventConfig('origin1', 'recursive_single'), function(EventInterface $event) {
return new Event('origin2', 'test');
})
->on(new EventConfig('origin1', 'recursive_multiple'), function(EventInterface $event) {
return [
new Event('origin1', 'recursive_single'),
new Event('origin2', 'test'),
];
})
->on(new EventConfig('origin2'), function(EventInterface $event) {
return null;
});
$router->send(new Event('origin1', 'first'));
Files (27) |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
src (7 directories) | ||||
tests (3 files, 2 directories) | ||||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files (27) | / | src |
File | Role | Description | ||
---|---|---|---|---|
Components (2 files) | ||||
Events (2 files) | ||||
Exceptions (1 file) | ||||
Interfaces (6 files) | ||||
Links (1 file) | ||||
Loggers (2 files) | ||||
Structs (2 files) |
Files (27) | / | src | / | Components |
File | Role | Description |
---|---|---|
EventRouter.php | Class | Class source |
EventRouterMap.php | Class | Class source |
Files (27) | / | src | / | Events |
File | Role | Description |
---|---|---|
Event.php | Class | Class source |
LinkedEvent.php | Class | Class source |
Files (27) | / | src | / | Interfaces |
File | Role | Description |
---|---|---|
EventConfigInterface.php | Class | Class source |
EventInterface.php | Class | Class source |
EventLinkInterface.php | Class | Class source |
EventRouterInterface.php | Class | Class source |
EventRouteRuleInterface.php | Class | Class source |
LoggerInterface.php | Class | Class source |
Files (27) | / | src | / | Loggers |
File | Role | Description |
---|---|---|
ArrayLogger.php | Class | Class source |
FakeLogger.php | Class | Class source |
Files (27) | / | src | / | Structs |
File | Role | Description |
---|---|---|
EventConfig.php | Class | Class source |
EventRouteRule.php | Class | Class source |
Files (27) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
unit (2 files) | ||||
_support (1 file) | ||||
coding_standard.xml | Data | Auxiliary data | ||
unit.suite.yml | Data | Auxiliary data | ||
_bootstrap.php | Aux. | Auxiliary script |
Files (27) | / | tests | / | unit |
File | Role | Description |
---|---|---|
EventRouterTest.php | Class | Class source |
EventTest.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.