20241102#1
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Правила для точек монтирования слоев
|
||||
*/
|
||||
|
||||
# Example:
|
||||
# ['key'=>'/', "action"=>"App\\Main\\Controllers\\IndexController", "method"=>"index"],
|
||||
# ['key'=>'/', 'router'=>'application/config/routes/main/routes.php'],
|
||||
# ['key'=>'/', 'router'=>[]],
|
||||
|
||||
return [
|
||||
['key'=>'/', 'router'=>'config/routes/routes.php'],
|
||||
];
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/**
|
||||
* Путь к файлу фабрики возвращающий реализацию RouterInterface или сам экземпляр класса
|
||||
*/
|
||||
\Rmphp\Foundation\RouterInterface::class => 'config/components/routerFactory.php',
|
||||
/**
|
||||
* Путь к файлу фабрики возвращающий реализацию TemplateInterface или сам экземпляр класса
|
||||
*/
|
||||
\Rmphp\Foundation\TemplateInterface::class => 'config/components/templateFactory.php',
|
||||
/**
|
||||
* Путь к файлу фабрики возвращающий реализацию PSR-3 LoggerInterface или сам экземпляр класса
|
||||
*/
|
||||
\Psr\Log\LoggerInterface::class => 'config/components/loggerFactory.php',
|
||||
/**
|
||||
* Путь к файлу фабрики возвращающий реализацию PSR-11 ContainerInterface или сам экземпляр класса
|
||||
*/
|
||||
\Psr\Container\ContainerInterface::class => 'config/components/containerFactory.php',
|
||||
];
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
use DI\ContainerBuilder;
|
||||
|
||||
$containerIni = (getenv("CONTAINER_INI")) ?: "config/container.php";
|
||||
$containerCache = (getenv("CONTAINER_CACHE")) ?: "var/cache/container";
|
||||
|
||||
$dependencies = require dirname(__DIR__,2).'/'.$containerIni;
|
||||
|
||||
$dependenciesCollection = array_map(function ($dependenciesFile){
|
||||
return require dirname(__DIR__,2)."/".$dependenciesFile;
|
||||
}, $dependencies);
|
||||
|
||||
try {
|
||||
$builder = new ContainerBuilder();
|
||||
if(getenv("APP_MODE") == "PROD") $builder->enableCompilation(dirname(__DIR__,2)."/".$containerCache);
|
||||
$builder->addDefinitions(array_replace_recursive(...$dependenciesCollection));
|
||||
return $builder->build();
|
||||
} catch (Exception $e) {echo $e->getMessage();}
|
||||
@@ -1,2 +0,0 @@
|
||||
<?php
|
||||
return (new \Monolog\Logger('system'))->pushHandler(new \Monolog\Handler\StreamHandler(dirname(__DIR__, 2).'/var/logs/log'.date('Ymd').'.log'));
|
||||
@@ -1,2 +0,0 @@
|
||||
<?php
|
||||
return new \Rmphp\Router\Router();
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
return (new \Rmphp\Content\Content('/templates/base.tpl'))->setSubtemplatePath('/templates/')->setSubtemplatePathAlias([
|
||||
"main" => "/src/Infrastructure/templates",
|
||||
]);
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
"config/container/services.php",
|
||||
"config/container/settings.php",
|
||||
];
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Rmphp\Cache\Cache;
|
||||
use Rmphp\Cache\CacheInterface;
|
||||
use Rmphp\Session\Session;
|
||||
use Rmphp\Session\SessionInterface;
|
||||
use Rmphp\Storage\Mysql\MysqlStorage;
|
||||
use Rmphp\Storage\Mysql\MysqlStorageInterface;
|
||||
|
||||
return [
|
||||
MysqlStorageInterface::class => DI\create(MysqlStorage::class)->constructor(json_decode(getenv("MYSQL_PARAM"), true)),
|
||||
SessionInterface::class => DI\create(Session::class)->constructor(),
|
||||
CacheInterface::class => DI\create(Cache::class)->constructor("../var/cache"),
|
||||
'App\*\Domain\Repository\*RepositoryInterface' => DI\autowire('App\*\Infrastructure\Repository\*Repository'),
|
||||
];
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
//"container key"=>value
|
||||
];
|
||||
@@ -1,13 +0,0 @@
|
||||
# Index
|
||||
- key: "/"
|
||||
routes:
|
||||
- action: "App\\Infrastructure\\Controllers\\IndexController"
|
||||
method: "index"
|
||||
params: ""
|
||||
|
||||
# Empty
|
||||
- key: "<@any>"
|
||||
routes:
|
||||
- action: "App\\nfrastructure\\Controllers\\IndexController"
|
||||
method: "emptyAction"
|
||||
params: ""
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
if(getenv("APP_MODE") == "PROD" && file_exists(dirname(__DIR__,2).'/var/routes/routes-main')){
|
||||
return unserialize(file_get_contents(dirname(__DIR__,2).'/var/routes/routes-main'));
|
||||
} else {
|
||||
$routesCollection = array_map(function ($routesFile){
|
||||
return file_get_contents($routesFile).PHP_EOL;
|
||||
}, glob(__DIR__."/{*.yaml}", GLOB_BRACE));
|
||||
|
||||
$routes = yaml_parse(implode($routesCollection));
|
||||
|
||||
if (!is_dir(dirname(__DIR__, 2).'/var/routes')) mkdir(dirname(__DIR__, 2).'/var/routes', 0777, true);
|
||||
file_put_contents(dirname(__DIR__, 2).'/var/routes/routes-main', serialize($routes));
|
||||
return $routes;
|
||||
}
|
||||
Reference in New Issue
Block a user