Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
//services.php
$di->setShared('dispatcher', function(){
$eventsManager = new Phalcon\Events\Manager();
$eventsManager->attach("dispatch:beforeException", function($event, $dispatcher) {
$dispatcher->forward([
'controller' => 'error',
]);
return false;
});
$dispatcher = new Phalcon\Mvc\Dispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment