Events - notihnio/mgr GitHub Wiki
MGR is an event driven framework. By default there are predefined events but you can bind and trigger your custom event at will.
Predefined events
init the event that triggered before Core initialization
predispach the event that triggers before Core dispatch and after core initialization
postdispach the event that triggers after Core dispatch
router.preDispach triggers before router dispatch
router.postDispach triggers after router dispatch
The events sequence is: init -> predispach -> router.preDispach -> router.postDispach -> postdispach.
default event call back functions placed on Bootstrap class on Application/Bootstap.php on example application
Custom events
With MGR you can also define your custom events.
example
bind a custom event:
\Mgr\Event\Event::bind('FooEvent', function($args = array()){ echo $args["bar"]; });
trigger custom event
\Mgr\Event\Event::trigger('FooEvent', array("bar"=>"BAR"));