skies-api/public/index.php

31 lines
935 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
// Delegate static file requests back to the PHP built-in webserver
if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) {
return false;
}
chdir(dirname(__DIR__));
require 'vendor/autoload.php';
2017-11-06 13:18:39 +01:00
/**
* Self-called anonymous function that creates its own scope and keep the global namespace clean.
*/
(function () {
/** @var \Psr\Container\ContainerInterface $container */
2017-11-06 13:18:39 +01:00
$container = require 'config/container.php';
2017-11-06 13:18:39 +01:00
/** @var \Zend\Expressive\Application $app */
$app = $container->get(\Zend\Expressive\Application::class);
$factory = $container->get(\Zend\Expressive\MiddlewareFactory::class);
2017-11-06 13:18:39 +01:00
// Execute programmatic/declarative middleware pipeline and routing
2017-11-06 13:18:39 +01:00
// configuration statements
(require 'config/pipeline.php')($app, $factory, $container);
(require 'config/routes.php')($app, $factory, $container);
2017-11-06 13:18:39 +01:00
$app->run();
})();