diff --git a/.env.dist b/.env.dist index 30a1227..72ed017 100644 --- a/.env.dist +++ b/.env.dist @@ -10,14 +10,14 @@ # PROD / DEV APP_MODE=DEV -APP_NODES_FILE=application/config/app.php -APP_COMPONENTS_FILE=application/config/components.php -CONTAINER_INI=application/config/container.php +APP_NODES_FILE=config/app.php +APP_COMPONENTS_FILE=config/components.php +CONTAINER_INI=config/container.php CONTAINER_CACHE=var/cache/container # Default page -PAGE404="/application/src/Infrastructure/templates/error/404.tpl" -PAGE501="/application/src/Infrastructure/templates/error/501.tpl" +PAGE404="/templates/error/404.tpl" +PAGE501="/templates/error/501.tpl" # Users environment MYSQL_PARAM='{"host":"host.docker.internal", "user":"***user***", "pass":"***password***","base":"***basename***", "logsEnable":true}' diff --git a/application/config/container.php b/application/config/container.php deleted file mode 100644 index d9064ed..0000000 --- a/application/config/container.php +++ /dev/null @@ -1,5 +0,0 @@ -setSubtemplatePath('/application/src/Infrastructure/templates/')->setSubtemplatePathAlias([ - "main" => "/src/Infrastructure/templates", -]); diff --git a/composer.json b/composer.json index 2f0b624..972c761 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,7 @@ }, "autoload": { "psr-4": { - "App\\": "src", - "Base\\": "application/src" + "App\\": "src" } }, "scripts": { diff --git a/application/config/app.php b/config/app.php similarity index 82% rename from application/config/app.php rename to config/app.php index e0ed3f8..09dcf56 100644 --- a/application/config/app.php +++ b/config/app.php @@ -9,5 +9,5 @@ # ['key'=>'/', 'router'=>[]], return [ - ['key'=>'/', 'router'=>'application/config/routes/routes.php'], + ['key'=>'/', 'router'=>'config/routes/routes.php'], ]; diff --git a/application/config/components.php b/config/components.php similarity index 64% rename from application/config/components.php rename to config/components.php index 309f0fb..77b97ee 100644 --- a/application/config/components.php +++ b/config/components.php @@ -4,18 +4,17 @@ return [ /** * Путь к файлу фабрики возвращающий реализацию RouterInterface или сам экземпляр класса */ - \Rmphp\Foundation\RouterInterface::class => 'application/config/factories/routerFactory.php', + \Rmphp\Foundation\RouterInterface::class => 'config/components/routerFactory.php', /** * Путь к файлу фабрики возвращающий реализацию TemplateInterface или сам экземпляр класса */ - \Rmphp\Foundation\TemplateInterface::class => 'application/config/factories/templateFactory.php', + \Rmphp\Foundation\TemplateInterface::class => 'config/components/templateFactory.php', /** * Путь к файлу фабрики возвращающий реализацию PSR-3 LoggerInterface или сам экземпляр класса */ - \Psr\Log\LoggerInterface::class => 'application/config/factories/loggerFactory.php', + \Psr\Log\LoggerInterface::class => 'config/components/loggerFactory.php', /** * Путь к файлу фабрики возвращающий реализацию PSR-11 ContainerInterface или сам экземпляр класса */ - \Psr\Container\ContainerInterface::class => 'application/config/factories/containerFactory.php', + \Psr\Container\ContainerInterface::class => 'config/components/containerFactory.php', ]; - \ No newline at end of file diff --git a/application/config/factories/containerFactory.php b/config/components/containerFactory.php similarity index 65% rename from application/config/factories/containerFactory.php rename to config/components/containerFactory.php index c01cd8b..e27eeee 100644 --- a/application/config/factories/containerFactory.php +++ b/config/components/containerFactory.php @@ -2,18 +2,18 @@ use DI\ContainerBuilder; -$containerIni = (getenv("CONTAINER_INI")) ?: "application/config/container.php"; +$containerIni = (getenv("CONTAINER_INI")) ?: "config/container.php"; $containerCache = (getenv("CONTAINER_CACHE")) ?: "var/cache/container"; -$dependencies = require dirname(__DIR__,3).'/'.$containerIni; +$dependencies = require dirname(__DIR__,2).'/'.$containerIni; $dependenciesCollection = array_map(function ($dependenciesFile){ - return require dirname(__DIR__,3)."/".$dependenciesFile; + return require dirname(__DIR__,2)."/".$dependenciesFile; }, $dependencies); try { $builder = new ContainerBuilder(); - if(getenv("APP_MODE") == "PROD") $builder->enableCompilation(dirname(__DIR__,3)."/".$containerCache); + 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();} diff --git a/application/config/factories/loggerFactory.php b/config/components/loggerFactory.php similarity index 57% rename from application/config/factories/loggerFactory.php rename to config/components/loggerFactory.php index 01598a6..e18b6bf 100644 --- a/application/config/factories/loggerFactory.php +++ b/config/components/loggerFactory.php @@ -1,2 +1,2 @@ pushHandler(new \Monolog\Handler\StreamHandler(dirname(__DIR__, 3).'/var/logs/log'.date('Ymd').'.log')); +return (new \Monolog\Logger('system'))->pushHandler(new \Monolog\Handler\StreamHandler(dirname(__DIR__, 2).'/var/logs/log'.date('Ymd').'.log')); diff --git a/application/config/factories/routerFactory.php b/config/components/routerFactory.php similarity index 100% rename from application/config/factories/routerFactory.php rename to config/components/routerFactory.php diff --git a/config/components/templateFactory.php b/config/components/templateFactory.php new file mode 100644 index 0000000..fc2440a --- /dev/null +++ b/config/components/templateFactory.php @@ -0,0 +1,4 @@ +setSubtemplatePath('/templates/')->setSubtemplatePathAlias([ + "main" => "/src/Infrastructure/templates", +]); diff --git a/config/container.php b/config/container.php new file mode 100644 index 0000000..f336b2e --- /dev/null +++ b/config/container.php @@ -0,0 +1,5 @@ +data = $data; } -} \ No newline at end of file +} diff --git a/application/src/Application/DTOException.php b/src/Infrastructure/Base/Application/DTOException.php similarity index 84% rename from application/src/Application/DTOException.php rename to src/Infrastructure/Base/Application/DTOException.php index 835ef8e..e9fdb9a 100644 --- a/application/src/Application/DTOException.php +++ b/src/Infrastructure/Base/Application/DTOException.php @@ -1,7 +1,7 @@ data = $data; } -} \ No newline at end of file +} diff --git a/application/src/Infrastructure/Controllers/AbstractController.php b/src/Infrastructure/Base/Controllers/AbstractController.php similarity index 98% rename from application/src/Infrastructure/Controllers/AbstractController.php rename to src/Infrastructure/Base/Controllers/AbstractController.php index a862689..2955518 100644 --- a/application/src/Infrastructure/Controllers/AbstractController.php +++ b/src/Infrastructure/Base/Controllers/AbstractController.php @@ -1,6 +1,6 @@ id)) ? (($this->id instanceof ValueObjectInterface) ? $this->id->get() : $this->id) : null; } -} \ No newline at end of file +} diff --git a/application/src/Domain/DomainException.php b/src/Infrastructure/Base/Domain/DomainException.php similarity index 85% rename from application/src/Domain/DomainException.php rename to src/Infrastructure/Base/Domain/DomainException.php index 277e69b..8e2da71 100644 --- a/application/src/Domain/DomainException.php +++ b/src/Infrastructure/Base/Domain/DomainException.php @@ -1,6 +1,6 @@ data = $data; } -} \ No newline at end of file +} diff --git a/application/src/Domain/EntityInterface.php b/src/Infrastructure/Base/Domain/EntityInterface.php similarity index 80% rename from application/src/Domain/EntityInterface.php rename to src/Infrastructure/Base/Domain/EntityInterface.php index a444486..5cad5a4 100644 --- a/application/src/Domain/EntityInterface.php +++ b/src/Infrastructure/Base/Domain/EntityInterface.php @@ -6,7 +6,7 @@ * Time: 3:58 */ -namespace Base\Domain; +namespace App\Infrastructure\Base\Domain; interface EntityInterface { @@ -15,4 +15,4 @@ interface EntityInterface { */ public function getId(): mixed; -} \ No newline at end of file +} diff --git a/application/src/Domain/ValueObjectInterface.php b/src/Infrastructure/Base/Domain/ValueObjectInterface.php similarity index 81% rename from application/src/Domain/ValueObjectInterface.php rename to src/Infrastructure/Base/Domain/ValueObjectInterface.php index 0703acc..86c2030 100644 --- a/application/src/Domain/ValueObjectInterface.php +++ b/src/Infrastructure/Base/Domain/ValueObjectInterface.php @@ -6,11 +6,11 @@ * Time: 3:58 */ -namespace Base\Domain; +namespace App\Infrastructure\Base\Domain; interface ValueObjectInterface { public function get(); public function __toString(): string; -} \ No newline at end of file +} diff --git a/application/src/Infrastructure/Repository/AbstractMysqlRepository.php b/src/Infrastructure/Base/Repository/AbstractMysqlRepository.php similarity index 91% rename from application/src/Infrastructure/Repository/AbstractMysqlRepository.php rename to src/Infrastructure/Base/Repository/AbstractMysqlRepository.php index 59d3d7f..6a32189 100644 --- a/application/src/Infrastructure/Repository/AbstractMysqlRepository.php +++ b/src/Infrastructure/Base/Repository/AbstractMysqlRepository.php @@ -1,8 +1,8 @@ data = $data; } -} \ No newline at end of file +} diff --git a/application/src/Infrastructure/Components/.gitkeep b/src/Infrastructure/Components/.gitkeep similarity index 100% rename from application/src/Infrastructure/Components/.gitkeep rename to src/Infrastructure/Components/.gitkeep diff --git a/src/Infrastructure/Controllers/IndexController.php b/src/Infrastructure/Controllers/IndexController.php index 836b177..5fc13bf 100644 --- a/src/Infrastructure/Controllers/IndexController.php +++ b/src/Infrastructure/Controllers/IndexController.php @@ -1,7 +1,7 @@