UI
This commit is contained in:
40
ui/setup/app.php
Normal file
40
ui/setup/app.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
use DI\ContainerBuilder as Builder;
|
||||
use DI\Bridge\Slim\Bridge;
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
$builder = new Builder();
|
||||
$folders = [
|
||||
'settings',
|
||||
'setups'
|
||||
];
|
||||
foreach ($folders as $folder) {
|
||||
$name = implode(DIRECTORY_SEPARATOR, [__DIR__, $folder]);
|
||||
if (!file_exists($name)) {
|
||||
continue;
|
||||
}
|
||||
$files = new DirectoryIterator($name);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
$builder->addDefinitions($file->getRealPath());
|
||||
}
|
||||
}
|
||||
|
||||
$container = $builder->build();
|
||||
$app = Bridge::create($container);
|
||||
|
||||
$folder = implode(DIRECTORY_SEPARATOR, [__DIR__, 'middlewares']);
|
||||
if (file_exists($folder)) {
|
||||
$files = new DirectoryIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir()) {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
||||
}
|
||||
|
||||
include_once 'router.php';
|
6
ui/setup/composer.php
Normal file
6
ui/setup/composer.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
require_once implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__),
|
||||
'vendor',
|
||||
'autoload.php'
|
||||
]);
|
9
ui/setup/router.php
Normal file
9
ui/setup/router.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$folder = $app->getContainer()->get('folders')->routes;
|
||||
$files = new DirectoryIterator($folder);
|
||||
foreach ($files as $file) {
|
||||
if ($file->isDir() or $file->getExtension() !== 'php') {
|
||||
continue;
|
||||
}
|
||||
include_once $file->getRealPath();
|
||||
}
|
23
ui/setup/settings/01_env.php
Normal file
23
ui/setup/settings/01_env.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
return [
|
||||
'folders' => function() {
|
||||
$arr = ['base' => dirname(__DIR__, 2)];
|
||||
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['base'],
|
||||
'resources'
|
||||
]);
|
||||
$arr['routes'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['resources'],
|
||||
'routes'
|
||||
]);
|
||||
$arr['templates'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['resources'],
|
||||
'views'
|
||||
]);
|
||||
$arr['cache'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['base'],
|
||||
'cache'
|
||||
]);
|
||||
return (object) $arr;
|
||||
}
|
||||
];
|
10
ui/setup/settings/02_urls.php
Normal file
10
ui/setup/settings/02_urls.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
return [
|
||||
'urls' => function() {
|
||||
$arr = ['base' => $_ENV['BASE_URL']];
|
||||
$arr['api'] = $_ENV['API_URL'];
|
||||
$arr['money'] = 'http://provm.cl/money';
|
||||
$arr['incoviba'] = 'http://provm.cl/incoviba';
|
||||
return (object) $arr;
|
||||
}
|
||||
];
|
15
ui/setup/setups/01_blade.php
Normal file
15
ui/setup/setups/01_blade.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
Slim\Views\Blade::class => function(Container $c) {
|
||||
return new Slim\Views\Blade(
|
||||
$c->get('folders')->templates,
|
||||
$c->get('folders')->cache,
|
||||
null,
|
||||
[
|
||||
'urls' => $c->get('urls')
|
||||
]
|
||||
);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user