Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ea833db5a | ||
|
|
19b505a458 |
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="public/web/404.html"
|
||||
PAGE501="public/web/501.html"
|
||||
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}'
|
||||
@@ -10,10 +10,3 @@ 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"
|
||||
```
|
||||
@@ -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();}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<?php
|
||||
return (new \Rmphp\Content\Content('public/web/main/sheet.html'))->setSubtemplePath('templates');
|
||||
return (new \Rmphp\Content\Content('templates/base.tpl'))->setSubtemplePath('templates');
|
||||
@@ -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": ""}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -23,17 +23,7 @@ $response = $app->handler($request, (new Response())->withHeader("Content-Type",
|
||||
(new ResponseEmitter())->emit($response);
|
||||
|
||||
|
||||
if(getenv("APP_MODE") == 'DEV' && in_array("Dev", $response->getHeader("App-Mode"))){
|
||||
$app->syslogger()->dump("request", $request);
|
||||
$app->syslogger()->dump("response", $response);
|
||||
$app->syslogger()->dump("globals", [
|
||||
"ENV"=>$_ENV,
|
||||
"GET"=>$request->getQueryParams(),
|
||||
"POST"=>$request->getParsedBody(),
|
||||
"COOKIE"=>$request->getCookieParams(),
|
||||
"SESSION"=>$_SESSION ?? [],
|
||||
"SERVER"=>$request->getServerParams()
|
||||
]);
|
||||
$app->syslogger()->dump("kernel", $app);
|
||||
if(getenv("APP_MODE") == 'DEV' || in_array("Dev", $response->getHeader("App-Mode"))){
|
||||
$app->syslogger()->dump("Response", $response);
|
||||
addShutdownInfo($app->syslogger()->getLogs());
|
||||
}
|
||||
@@ -5,15 +5,11 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Rmphp - <?=$this->getPoint('title')?></title>
|
||||
<link href="/web/main/css/style.css?1" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link href="/assets/css/style.css?1" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<?=$this->getPoint('main')?>
|
||||
<script type="text/javascript" src="/web/main/js/script.js?1"></script>
|
||||
<script type="text/javascript" src="/assets/js/script.js?1"></script>
|
||||
<?=$this->getPoint('jsscript')?>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user