Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** Register router */
- $dependencyInjector->set(
- 'router', function () {
- $router = new \Phalcon\Mvc\Router();
- require BOOTSTRAP_DIR_PATH . '/routes_frontend.php';
- require BOOTSTRAP_DIR_PATH . '/routes_backend.php';
- require BOOTSTRAP_DIR_PATH . '/routes_apiv1.php';
- return $router;
- }
- );
- /** Register dispatcher */
- $dependencyInjector->set(
- 'dispatcher', function () use ($dependencyInjector) {
- die('called');
- //Obtain the standard eventsManager from the DI
- $eventsManager = $dependencyInjector->getShared('eventsManager');
- //Attach the plugin to 'dispatch' events
- $eventsManager->attach('dispatch', new \Crocofy\Plugin\CacheEnabler());
- $dispatcher = new Phalcon\Mvc\Dispatcher();
- $dispatcher->setEventsManager($eventsManager);
- return $dispatcher;
- }
- );
- /** Register app settings */
- $dependencyInjector->setShared(
- 'config', function () {
- $configs = new \Phalcon\Config(require CONFIGS_PATH . '/live.php');
- if (APPLICATION_ENV === 'staging' || APPLICATION_ENV === 'dev') {
- $configs->merge(new \Phalcon\Config(require CONFIGS_PATH . '/staging.php'));
- }
- if (APPLICATION_ENV === 'dev') {
- $configs->merge(new \Phalcon\Config(require CONFIGS_PATH . '/dev.php'));
- }
- if (APPLICATION_ENV === 'test') {
- $configs->merge(new \Phalcon\Config(require CONFIGS_PATH . '/test.php'));
- }
- return $configs;
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement