20240708#1
This commit is contained in:
@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton project-name
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer create-project rmphp/skeleton:"^4.2" project-name
|
composer create-project rmphp/skeleton:"^4.3" project-name
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
return (new \Rmphp\Content\Content('/application/src/Presentation/templates/base.tpl'))->setSubtemplatePath('/application/src/Presentation/templates/')->setSubtemplatePathAlias([
|
return (new \Rmphp\Content\Content('/application/src/Infrastructure/templates/base.tpl'))->setSubtemplatePath('/application/src/Infrastructure/templates/')->setSubtemplatePathAlias([
|
||||||
"main" => "/src/Main/Presentation/templates",
|
"main" => "/src/Main/Infrastructure/templates",
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# Index
|
# Index
|
||||||
- key: "/"
|
- key: "/"
|
||||||
routes:
|
routes:
|
||||||
- action: "App\\Main\\Presentation\\Controllers\\IndexController"
|
- action: "App\\Main\\Infrastructure\\Controllers\\IndexController"
|
||||||
method: "index"
|
method: "index"
|
||||||
params: ""
|
params: ""
|
||||||
|
|
||||||
# Empty
|
# Empty
|
||||||
- key: "<@any>"
|
- key: "<@any>"
|
||||||
routes:
|
routes:
|
||||||
- action: "App\\Main\\Presentation\\Controllers\\IndexController"
|
- action: "App\\Main\\Infrastructure\\Controllers\\IndexController"
|
||||||
method: "emptyAction"
|
method: "emptyAction"
|
||||||
params: ""
|
params: ""
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Base\Presentation\Controllers;
|
namespace Base\Infrastructure\Controllers;
|
||||||
|
|
||||||
use Laminas\Diactoros\Response\HtmlResponse;
|
use Laminas\Diactoros\Response\HtmlResponse;
|
||||||
use Laminas\Diactoros\Response\JsonResponse;
|
use Laminas\Diactoros\Response\JsonResponse;
|
||||||
@@ -146,4 +146,4 @@ abstract class AbstractController extends Main {
|
|||||||
public function getTemplatePath(string $path) : string {
|
public function getTemplatePath(string $path) : string {
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Base\Presentation\Controllers;
|
namespace Base\Infrastructure\Controllers;
|
||||||
|
|
||||||
use Base\Application\ApplicationException;
|
use Base\Application\ApplicationException;
|
||||||
use Base\Application\DTOException;
|
use Base\Application\DTOException;
|
||||||
@@ -32,4 +32,4 @@ abstract class AbstractPageController extends AbstractController {
|
|||||||
if($e instanceof DTOException || $e instanceof DomainException || $e instanceof ApplicationException) return $e->getMessage();
|
if($e instanceof DTOException || $e instanceof DomainException || $e instanceof ApplicationException) return $e->getMessage();
|
||||||
return "Ошибка. Дата и время: ".date("d-m-Y H:i:s");
|
return "Ошибка. Дата и время: ".date("d-m-Y H:i:s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Base\Presentation\Controllers;
|
namespace Base\Infrastructure\Controllers;
|
||||||
|
|
||||||
class NotFoundException extends \Exception {
|
class NotFoundException extends \Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,15 +11,19 @@ require_once dirname(__DIR__).'/vendor/autoload.php';
|
|||||||
|
|
||||||
(new Symfony\Component\Dotenv\Dotenv())->usePutenv()->loadEnv(dirname(__DIR__).'/.env');
|
(new Symfony\Component\Dotenv\Dotenv())->usePutenv()->loadEnv(dirname(__DIR__).'/.env');
|
||||||
|
|
||||||
error_reporting(0); ini_set('display_errors','Off');
|
if(getenv("APP_MODE") == 'DEBUG'){
|
||||||
|
error_reporting(E_ALL); ini_set('display_errors','On');
|
||||||
|
} else {
|
||||||
|
error_reporting(0); ini_set('display_errors','Off');
|
||||||
|
}
|
||||||
|
|
||||||
$request = ServerRequestFactory::fromGlobals();
|
$request = ServerRequestFactory::fromGlobals();
|
||||||
|
|
||||||
$app = new App();
|
$app = new App();
|
||||||
$response = $app->handler($request, (new Response())->withHeader("Content-Type", "text/html; charset=utf-8"));
|
$response = $app->handler($request, new Response());
|
||||||
(new ResponseEmitter())->emit($response);
|
(new ResponseEmitter())->emit($response);
|
||||||
|
|
||||||
if(($response->getStatusCode() !== 200 && getenv("APP_MODE") == 'DEV') || in_array("Dev", $response->getHeader("App-Mode"))){
|
if(($response->getStatusCode() !== 200 && getenv("APP_MODE") == 'DEV') || in_array("Dev", $response->getHeader("App-Mode"))){
|
||||||
$app->syslogger()->dump("Response", $response);
|
$app->syslogger()->dump("Response", $response);
|
||||||
addShutdownInfo($app->syslogger()->getLogs());
|
addShutdownInfo($app->syslogger()->getLogs());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Main\Presentation\Controllers;
|
namespace App\Main\Infrastructure\Controllers;
|
||||||
use Base\Presentation\Controllers\AbstractPageController;
|
use Base\Infrastructure\Controllers\AbstractPageController;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
class IndexController extends AbstractPageController {
|
class IndexController extends AbstractPageController {
|
||||||
Reference in New Issue
Block a user