v0.2.0
This commit is contained in:
45
bootstrap/app.php
Normal file
45
bootstrap/app.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
use DI\Bridge\Slim\Bridge;
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
$container_builder = new DI\ContainerBuilder();
|
||||
|
||||
$folders = [
|
||||
'common'
|
||||
];
|
||||
if (isset($_ENV)) {
|
||||
$folders []= $_ENV;
|
||||
}
|
||||
|
||||
$file = 'config.php';
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, $folder, $file]);
|
||||
if (file_exists($filename)) {
|
||||
$container_builder->addDefinitions($filename);
|
||||
}
|
||||
}
|
||||
|
||||
$file = 'setup.php';
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, $folder, $file]);
|
||||
if (file_exists($filename)) {
|
||||
$container_builder->addDefinitions($filename);
|
||||
}
|
||||
}
|
||||
|
||||
$container = $container_builder->build();
|
||||
$app = Bridge::create($container);
|
||||
$app->setBasePath($container->get('urls.base'));
|
||||
$app->addRoutingMiddleware();
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
|
||||
$file = 'middleware.php';
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, $folder, $file]);
|
||||
if (file_exists($filename)) {
|
||||
include_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
include_once implode(DIRECTORY_SEPARATOR, [$app->getContainer()->get('folders.routes'), 'router.php']);
|
13
bootstrap/common/config.php
Normal file
13
bootstrap/common/config.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
return [
|
||||
'folders.base' => dirname(__DIR__, 2),
|
||||
'folders.resources' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.base}',
|
||||
'resources'
|
||||
])),
|
||||
'folders.routes' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.resources}',
|
||||
'routes'
|
||||
])),
|
||||
'urls.base' => '/provm/raby'
|
||||
];
|
6
bootstrap/composer.php
Normal file
6
bootstrap/composer.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require_once implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__),
|
||||
'vendor',
|
||||
'autoload.php'
|
||||
]);
|
3
bootstrap/web.php
Normal file
3
bootstrap/web.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$_ENV = 'web';
|
||||
include_once 'app.php';
|
35
bootstrap/web/config.php
Normal file
35
bootstrap/web/config.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
return [
|
||||
'folders.templates' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.resources}',
|
||||
'views'
|
||||
])),
|
||||
'folders.cache' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.resources}',
|
||||
'cache'
|
||||
])),
|
||||
'blade_template_path' => DI\get('folders.templates'),
|
||||
'blade_cache_path' => DI\get('folders.cache'),
|
||||
'urls.assets' => DI\string(implode('/', [
|
||||
'{urls.base}',
|
||||
'assets'
|
||||
])),
|
||||
'urls.images' => DI\string(implode('/', [
|
||||
'{urls.assets}',
|
||||
'images'
|
||||
])),
|
||||
'assets' => (object) [
|
||||
(object) [
|
||||
'script' => 'https://code.jquery.com/jquery-3.4.1.min.js'
|
||||
],
|
||||
(object) [
|
||||
'script' => 'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.js',
|
||||
'style' => 'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.css',
|
||||
'fonts' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/brand-icons.woff2',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/icons.woff2',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/outline-icons.woff2'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
2
bootstrap/web/middleware.php
Normal file
2
bootstrap/web/middleware.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
//$app->add(new Zeuxisoo\Whoops\Slim\WhoopsMiddleware);
|
21
bootstrap/web/setup.php
Normal file
21
bootstrap/web/setup.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
return [
|
||||
Slim\Views\Blade::class => function(ContainerInterface $container) {
|
||||
return new Slim\Views\Blade(
|
||||
$container->get('blade_template_path'),
|
||||
$container->get('blade_cache_path'),
|
||||
null,
|
||||
[
|
||||
'urls' => (object) [
|
||||
'base' => $container->get('urls.base'),
|
||||
'assets' => (object) [
|
||||
'images' => $container->get('urls.images')
|
||||
]
|
||||
],
|
||||
'assets' => $container->get('assets')
|
||||
]
|
||||
);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user