gallery-api/public/index.php

31 lines
908 B
PHP
Raw Normal View History

2017-07-21 19:59:16 +02:00
<?php
2020-04-23 18:26:12 +02:00
declare(strict_types=1);
2017-07-21 19:59:16 +02:00
// Delegate static file requests back to the PHP built-in webserver
2020-04-23 18:26:12 +02:00
if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) {
2017-07-21 19:59:16 +02: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.
*/
2020-04-23 18:26:12 +02:00
(function () {
/** @var \Psr\Container\ContainerInterface $container */
2017-07-21 19:59:16 +02:00
$container = require 'config/container.php';
2020-05-01 13:46:59 +02:00
/** @var \Mezzio\Application $app */
$app = $container->get(\Mezzio\Application::class);
$factory = $container->get(\Mezzio\MiddlewareFactory::class);
2017-07-21 19:59:16 +02:00
2020-04-23 18:26:12 +02:00
// Execute programmatic/declarative middleware pipeline and routing
2017-07-21 19:59:16 +02:00
// configuration statements
2020-04-23 18:26:12 +02:00
(require 'config/pipeline.php')($app, $factory, $container);
(require 'config/routes.php')($app, $factory, $container);
2017-07-21 19:59:16 +02:00
$app->run();
2020-04-23 18:26:12 +02:00
})();