1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
9 |
efrain |
5 |
|
288 |
www |
6 |
|
1 |
efrain |
7 |
use Laminas\Mvc\Application;
|
|
|
8 |
use Laminas\Stdlib\ArrayUtils;
|
|
|
9 |
|
42 |
efrain |
10 |
|
|
|
11 |
|
1 |
efrain |
12 |
/**
|
|
|
13 |
* This makes our life easier when dealing with paths. Everything is relative
|
|
|
14 |
* to the application root now.
|
|
|
15 |
*/
|
|
|
16 |
chdir(dirname(__DIR__));
|
|
|
17 |
|
|
|
18 |
// Decline static file requests back to the PHP built-in webserver
|
|
|
19 |
if (php_sapi_name() === 'cli-server') {
|
|
|
20 |
$path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
|
|
|
21 |
if (is_string($path) && __FILE__ !== $path && is_file($path)) {
|
|
|
22 |
return false;
|
|
|
23 |
}
|
|
|
24 |
unset($path);
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
// Composer autoloading
|
|
|
28 |
include __DIR__ . '/../vendor/autoload.php';
|
|
|
29 |
|
|
|
30 |
if (! class_exists(Application::class)) {
|
|
|
31 |
throw new RuntimeException(
|
|
|
32 |
"Unable to load application.\n"
|
|
|
33 |
. "- Type `composer install` if you are developing locally.\n"
|
|
|
34 |
. "- Type `vagrant ssh -c 'composer install'` if you are using Vagrant.\n"
|
|
|
35 |
. "- Type `docker-compose run lamians composer install` if you are using Docker.\n"
|
|
|
36 |
);
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
// Retrieve configuration
|
|
|
40 |
$appConfig = require __DIR__ . '/../config/application.config.php';
|
|
|
41 |
if (file_exists(__DIR__ . '/../config/development.config.php')) {
|
|
|
42 |
$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
// Run the application!
|
|
|
46 |
Application::init($appConfig)->run();
|