diff --git a/.env.dist b/.env.dist index a01b516..4a0e994 100644 --- a/.env.dist +++ b/.env.dist @@ -8,24 +8,15 @@ # # Real environment variables win over .env files. -# App mode (DEV, TEST, PROD) APP_MODE=DEV - -# Including file with array of componens -APP_COMPONENTS_FILE="config/components.php" - -# Including file with array of app nodes -APP_NODES_FILE="config/appnodes.php" - -# Define app nodes -#APP_NODE1='{"key":"/","action":"App\\Auth\\Controllers\\UserController","method":"index"}' -#APP_NODE2='{"key":"/","router":"config/routes/main/collection.php"}' +APP_COMPONENTS_FILE=config/app.php +APP_NODES_FILE=config/nodes.php +CONTAINER_DIR=config/container +CONTAINER_CACHE=var/cache/container # Default page -PAGE404="templates/error/404.tpl" -PAGE501="templates/error/501.tpl" +PAGE404=templates/error/404.tpl +PAGE501=templates/error/501.tpl # Users environment - -CONTAINER_DIR="config/container" MYSQL_PARAM='{"host":"host.docker.internal", "user":"***user***", "pass":"***password***","base":"***basename***", "logsEnable":true}' \ No newline at end of file diff --git a/README.md b/README.md index 9f616a7..c3f879f 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,4 @@ composer create-project rmphp/skeleton ``` ```bash composer create-project rmphp/skeleton:"^1.0" -``` - - -Dev version contains the latest changes - -```bash -composer create-project rmphp/skeleton:"1.0.x-dev" ``` \ No newline at end of file diff --git a/config/components.php b/config/app.php similarity index 100% rename from config/components.php rename to config/app.php diff --git a/config/factories/containerFactory.php b/config/factories/containerFactory.php index 9fcfc3e..5d6f857 100644 --- a/config/factories/containerFactory.php +++ b/config/factories/containerFactory.php @@ -2,17 +2,17 @@ use DI\ContainerBuilder; -$containerDir = (getenv("CONTAINER_DIR"))?:"config/container/"; +$containerDir = (getenv("CONTAINER_DIR"))?:"config/container"; +$containerCache = (getenv("CONTAINER_CACHE"))?:"var/cache/container"; $dependencies = glob(dirname(__DIR__,2)."/".$containerDir."/*.php"); - $dependenciesCollection = array_map(function ($dependenciesFile){ return require $dependenciesFile; }, $dependencies); try { $builder = new ContainerBuilder(); - $builder->enableCompilation(__DIR__ . '/../../var/cache/container'); + if(getenv("APP_MODE") != "DEV") $builder->enableCompilation(dirname(__DIR__,2)."/".$containerCache); $builder->addDefinitions(array_replace_recursive(...$dependenciesCollection)); return $builder->build(); } catch (Exception $e) {echo $e->getMessage();} diff --git a/config/appnodes.php b/config/nodes.php similarity index 79% rename from config/appnodes.php rename to config/nodes.php index cb8e654..696fdf0 100644 --- a/config/appnodes.php +++ b/config/nodes.php @@ -7,8 +7,7 @@ # Example: # ['key'=>'/', "action"=>"App\\Main\\Controllers\\IndexController", "method"=>"index"], -# ['key'=>'/', 'router'=>'config/routes/main/collection.php'], -# ['key'=>'/', 'router'=>'config/routes/main.json'] +# ['key'=>'/', 'router'=>'config/routes/main/routes.php'], # ['key'=>'/', 'router'=>'config/routes/main.yaml'], return [ diff --git a/config/routes/main.json b/config/routes/main.json deleted file mode 100644 index 71c5560..0000000 --- a/config/routes/main.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "key": "/", - "routes": [ - {"action": "App\\Main\\Controllers\\IndexController", "method": "index", "params": ""} - ] - }, - { - "key": "[any]", - "routes": [ - {"action": "App\\Main\\Controllers\\IndexController", "method": "emptyAction", "params": ""} - ] - } -] \ No newline at end of file diff --git a/config/routes/main/collection.php b/config/routes/main/routes.php similarity index 100% rename from config/routes/main/collection.php rename to config/routes/main/routes.php diff --git a/src/Main/Domain/.gitkeep b/src/Main/Domain/DTO/.gitkeep similarity index 100% rename from src/Main/Domain/.gitkeep rename to src/Main/Domain/DTO/.gitkeep diff --git a/src/Main/Repository/DTO/.gitkeep b/src/Main/Domain/Repository/.gitkeep similarity index 100% rename from src/Main/Repository/DTO/.gitkeep rename to src/Main/Domain/Repository/.gitkeep diff --git a/src/Main/Repository/Interface/.gitkeep b/src/Main/Repository/Interface/.gitkeep deleted file mode 100644 index e69de29..0000000