4 Commits
1.0.1 ... 2.0

Author SHA1 Message Date
User
34de164e72 20230926#2 2023-09-26 21:50:53 +03:00
User
19731cb6fe 20230926#1 2023-09-26 16:50:06 +03:00
User
4c087a156b 20230926#1 2023-09-26 16:49:41 +03:00
User
4ea833db5a 20230818#1 2023-08-18 02:15:16 +03:00
13 changed files with 13 additions and 60 deletions

View File

@@ -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}'

View File

@@ -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"
```

View File

@@ -12,7 +12,7 @@
"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/storage": "^1.0"
@@ -30,6 +30,7 @@
"process-timeout":0
},
"require-dev": {
"symfony/var-dumper": "^5.3",
"rmphp/var-damper": "^1.0"
}
}

View File

@@ -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'),
];

View File

@@ -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();}

View File

@@ -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 [

View File

@@ -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": ""}
]
}
]

View File

@@ -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