3 require_once('../vendor/autoload.php');
5 $config = require('../config/app.php');
7 // Allow these origins to do cross domain JS.
8 header("Access-Control-Allow-Origin: " . $config['allow-origin']);
11 if($config['mode'] == 'production')
13 ini_set('display_errors', 0);
14 set_exception_handler(array('\Services\StatusReporter', 'exception'));
16 ini_set('display_errors', 1);
17 error_reporting(E_ALL
);
20 // Everything time related should be UTC+0 based
21 date_default_timezone_set('UTC');
23 // Set up the DI container
24 $containerBuilder = new DI\
ContainerBuilder();
25 $containerBuilder->addDefinitions('../config/DI.php');
26 $containerBuilder->useAutowiring(true
);
28 $container = $containerBuilder->build();
30 /* @var $router Services\Routing\IRouter */
31 $router = $container->get('Services\Routing\IRouter');
33 $controllerName= $router->getControllerName();
34 $controllerAction = $router->getActionName();
35 $controllerActionArgs = $router->getActionArgs();
37 $controller = $container->get('Controllers\\' . ucfirst($controllerName) . 'Controller' );
39 // Last thing to do, call the action on the specified controller.
40 call_user_func_array(array($controller, $controllerAction . 'Action'), $controllerActionArgs);