33 lines
849 B
PHP
33 lines
849 B
PHP
<?php
|
|
use Psr\Container\ContainerInterface as Container;
|
|
use Dotenv\Dotenv;
|
|
|
|
if (file_exists(implode(DIRECTORY_SEPARATOR, [dirname(__DIR__, 2), '.env']))) {
|
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 2));
|
|
$dotenv->load();
|
|
}
|
|
|
|
return [
|
|
'base_path' => $_ENV['BASE_PATH'] ?? null,
|
|
'base_url' => $_ENV['BASE_URL'] ?? null,
|
|
'locations' => DI\decorate(function($prev, Container $container) {
|
|
$arr = (array) $prev;
|
|
$arr['base'] = dirname(__DIR__, 2);
|
|
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
|
$arr['base'],
|
|
'resources'
|
|
]);
|
|
$arr['routes'] = implode(DIRECTORY_SEPARATOR, [
|
|
$arr['resources'],
|
|
'routes'
|
|
]);
|
|
return (object) $arr;
|
|
}),
|
|
'phinx' => function(Container $c) {
|
|
return implode(DIRECTORY_SEPARATOR, [
|
|
$c->get('locations')->base,
|
|
'phinx.php'
|
|
]);
|
|
}
|
|
];
|