This commit is contained in:
2021-08-10 15:52:03 -04:00
parent ed28bf360b
commit 740de41139
59 changed files with 3860 additions and 0 deletions

40
ui/setup/app.php Normal file
View 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
View File

@ -0,0 +1,6 @@
<?php
require_once implode(DIRECTORY_SEPARATOR, [
dirname(__DIR__),
'vendor',
'autoload.php'
]);

9
ui/setup/router.php Normal file
View 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();
}

View 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;
}
];

View 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;
}
];

View 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')
]
);
}
];