31 lines
935 B
PHP
Raw Normal View History

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