Version produccion
This commit is contained in:
8
bootstrap/api/config.php
Normal file
8
bootstrap/api/config.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
'urls.base' => DI\decorate(function($prev, Container $c) {
|
||||
return implode('/', [$prev, 'api']);
|
||||
})
|
||||
];
|
48
bootstrap/app.php
Normal file
48
bootstrap/app.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
use DI\ContainerBuilder as Builder;
|
||||
use DI\Bridge\Slim\Bridge;
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
$builder = new Builder();
|
||||
$folders = ['common'];
|
||||
if (isset($__environment)) {
|
||||
$folders []= $__environment;
|
||||
}
|
||||
$files = [
|
||||
'config',
|
||||
'setup'
|
||||
];
|
||||
foreach ($files as $file) {
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
$folder,
|
||||
$file . '.php'
|
||||
]);
|
||||
if (file_exists($filename)) {
|
||||
$builder->addDefinitions($filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
$container = $builder->build();
|
||||
$app = Bridge::create($container);
|
||||
$app->setBasePath($container->get('urls.base'));
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
$folder,
|
||||
'middleware.php'
|
||||
]);
|
||||
if (file_exists($filename)) {
|
||||
include_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
|
||||
include_once implode(DIRECTORY_SEPARATOR, [
|
||||
$container->get('folders.routes'),
|
||||
'router.php'
|
||||
]);
|
18
bootstrap/common/config.php
Normal file
18
bootstrap/common/config.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
return [
|
||||
'folders.base' => dirname(__DIR__, 2),
|
||||
'folders.config' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.base}',
|
||||
'config'
|
||||
])),
|
||||
'folders.resources' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.base}',
|
||||
'resources'
|
||||
])),
|
||||
'folders.routes' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.resources}',
|
||||
'routes'
|
||||
])),
|
||||
//'urls.base' => '/optimus/money'
|
||||
'urls.base' => ''
|
||||
];
|
14
bootstrap/common/setup.php
Normal file
14
bootstrap/common/setup.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
'config' => function(Container $c) {
|
||||
return (new Aldarien\Common\Service\Config($c->get('folders.config')))->load();
|
||||
},
|
||||
GuzzleHttp\ClientInterface::class => function(Container $c) {
|
||||
return new GuzzleHttp\Client();
|
||||
},
|
||||
Aldarien\Money\UF\Handler::class => function(Container $c) {
|
||||
return new Aldarien\Money\UF\Handler($c->get(GuzzleHttp\ClientInterface::class), 'https://mindicador.cl/api/uf');
|
||||
}
|
||||
];
|
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'
|
||||
]);
|
30
bootstrap/web/config.php
Normal file
30
bootstrap/web/config.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
return [
|
||||
'folders.cache' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.resources}',
|
||||
'cache'
|
||||
])),
|
||||
'folders.templates' => DI\string(implode(DIRECTORY_SEPARATOR, [
|
||||
'{folders.resources}',
|
||||
'views'
|
||||
])),
|
||||
'web.assets' => (object) [
|
||||
'styles' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.css'
|
||||
],
|
||||
'scripts' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/semantic.min.js'
|
||||
],
|
||||
'fonts' => [
|
||||
'text/css' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/brand-icons.woff',
|
||||
'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.woff',
|
||||
'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.woff',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.4/themes/default/assets/fonts/outline-icons.woff2'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
17
bootstrap/web/setup.php
Normal file
17
bootstrap/web/setup.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?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,
|
||||
[
|
||||
'base_url' => $c->get('urls.base'),
|
||||
'page_language' => 'es',
|
||||
'assets' => $c->get('web.assets')
|
||||
]
|
||||
);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user