Contributte Event-application-bridge
Website 🚀 contributte.org | Contact 👨🏻💻 f3l1x.io | Twitter 🐦 @contributte
# Disclaimer
⚠️ | This project is no longer being maintained. Please use contributte/event-dispatcher-extra (opens new window). |
---|
Composer | contributte/event-application-bridge (opens new window) |
---|---|
Version | |
PHP | |
License |
# Versions
State | Version | Branch | PHP |
---|---|---|---|
stable | ^0.1 | master | >= 5.6 |
# Documentation
# Usage 🎉
extensions:
events: Contributte\EventDispatcher\DI\EventDispatcherExtension
events2application: Contributte\Events\Bridges\Application\DI\EventApplicationBridgeExtension
1
2
3
2
3
# Bridge 🔧
There are several Nette Application events on which you can listen to.
use Contributte\Events\Bridges\Application\Event\ApplicationEvents;
use Contributte\Events\Bridges\Application\Event\ErrorEvent;
use Contributte\Events\Bridges\Application\Event\PresenterEvent;
use Contributte\Events\Bridges\Application\Event\RequestEvent;
use Contributte\Events\Bridges\Application\Event\ResponseEvent;
use Contributte\Events\Bridges\Application\Event\ShutdownEvent;
use Contributte\Events\Bridges\Application\Event\StartupEvent;
1
2
3
4
5
6
7
2
3
4
5
6
7
StartupEvent::NAME
&&ApplicationEvents::ON_STARTUP
ShutdownEvent::NAME
&&ApplicationEvents::ON_SHUTDOWN
RequestEvent::NAME
&&ApplicationEvents::ON_REQUEST
PresenterEvent::NAME
&&ApplicationEvents::ON_PRESENTER
ResponseEvent::NAME
&&ApplicationEvents::ON_RESPONSE
ErrorEvent::NAME
&&ApplicationEvents::ON_ERROR
# Subscriber 💡
use Contributte\EventDispatcher\EventSubscriber;
use Contributte\Events\Bridges\Application\Event\RequestEvent;
final class LogRequestSubscriber implements EventSubscriber
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [RequestEvent::NAME => 'onLog'];
}
/**
* @param RequestEvent $event
* @return void
*/
public function onLog(RequestEvent $event)
{
// Do magic..
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Development
This package was maintain by these authors.
Consider to support (opens new window) contributte development team. Also thank you for being used this package.