Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7df5be904f | ||
|
|
34de164e72 | ||
|
|
19731cb6fe | ||
|
|
4c087a156b | ||
|
|
4ea833db5a |
21
.env.dist
21
.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}'
|
||||
@@ -7,13 +7,7 @@ Stable version
|
||||
```bash
|
||||
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"
|
||||
composer create-project rmphp/skeleton:"^2.0"
|
||||
```
|
||||
@@ -12,9 +12,9 @@
|
||||
"monolog/monolog": "^2.3",
|
||||
"php-di/php-di": "^6.3",
|
||||
"symfony/dotenv": "^6.2",
|
||||
"rmphp/kernel": "^1.0",
|
||||
"rmphp/kernel": "^2.0",
|
||||
"rmphp/router": "^1.0",
|
||||
"rmphp/content": "^1.0",
|
||||
"rmphp/content": "^2.0",
|
||||
"rmphp/storage": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
@@ -30,6 +30,7 @@
|
||||
"process-timeout":0
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^5.3",
|
||||
"rmphp/var-damper": "^1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,4 @@ use Rmphp\Storage\MysqlStorageInterface;
|
||||
return [
|
||||
MysqlStorageInterface::class => DI\create(MysqlStorage::class)->constructor(json_decode(getenv("MYSQL_PARAM"), true)),
|
||||
'App\*\Domain\Repository\*RepositoryInterface' => DI\autowire('App\*\Repository\Mysql\*Repository'),
|
||||
'App\*\Services\*\*Service' => DI\autowire('App\*\Services\*\*Service'),
|
||||
'App\*\Services\*Service' => DI\autowire('App\*\Services\*Service'),
|
||||
];
|
||||
@@ -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();}
|
||||
|
||||
@@ -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 [
|
||||
@@ -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": ""}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -13,22 +13,6 @@ use Rmphp\Kernel\Main;
|
||||
|
||||
abstract class AbstractController extends Main {
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function containerGet(string $name) {
|
||||
try {
|
||||
return $this->container()->get($name);
|
||||
}
|
||||
catch (NotFoundExceptionInterface $notFoundException){
|
||||
$this->syslogger()->error($notFoundException->getMessage());
|
||||
}
|
||||
catch (ContainerExceptionInterface $containerException){
|
||||
$this->syslogger()->error($containerException->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $throwable
|
||||
* @param array $data
|
||||
|
||||
Reference in New Issue
Block a user