sms-store/public/index.php

31 lines
908 B
PHP
Raw Permalink Normal View History

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