5 Commits
4.7 ... 4.10

Author SHA1 Message Date
User
7d5538ad35 20250327#1 2025-03-27 03:15:13 +03:00
User
c2a14307ae 20250321#1 2025-03-21 21:50:55 +03:00
User
ddb82ee395 20250303#4 2025-03-03 15:25:46 +03:00
User
a095b76e8d 20250303#3 2025-03-03 14:30:02 +03:00
User
70810412f4 20250303#2 2025-03-03 14:25:44 +03:00
22 changed files with 28 additions and 31 deletions

View File

@@ -10,10 +10,10 @@
# PROD / DEV
APP_MODE=DEV
APP_NODES_FILE=application/config/app.php
CLI_NODES_FILE=application/config/app-cli.php
APP_COMPONENTS_FILE=application/config/components.php
CONTAINER_INI=application/config/container.php
APP_NODES_FILE=config/app.php
CLI_NODES_FILE=config/app-cli.php
APP_COMPONENTS_FILE=config/components.php
CONTAINER_INI=config/container.php
CONTAINER_CACHE=var/cache/container
# Default page

View File

@@ -9,5 +9,5 @@ composer create-project rmphp/skeleton project-name
```
```bash
composer create-project rmphp/skeleton:"^4.7" project-name
composer create-project rmphp/skeleton:"^4.10" project-name
```

View File

@@ -1,6 +1,6 @@
<?php
namespace Base\Controllers;
namespace Base\Handlers;
use Laminas\Diactoros\Response\HtmlResponse;
use Laminas\Diactoros\Response\JsonResponse;

View File

@@ -1,3 +1,3 @@
#!/usr/bin/php
<?php
require_once dirname(__FILE__).'/console.php';
require_once dirname(__FILE__).'/cli.php';

View File

@@ -1,3 +0,0 @@
#!/usr/bin/php
<?php
require_once dirname(__FILE__).'/console.php';

View File

@@ -1,5 +0,0 @@
<?php
return [
"application/config/container/services.php",
"application/config/container/settings.php",
];

View File

@@ -17,7 +17,7 @@
"rmphp/router": "^2.0",
"rmphp/session": "^1.1",
"rmphp/redis": "^1.0",
"rmphp/storage": "^6.0",
"rmphp/storage": "^8.0",
"symfony/dotenv": "^6.2"
},
"autoload": {

View File

@@ -1,7 +1,7 @@
<?php
# Example:
# ['key'=>'/', "action"=>"App\\Main\\Controllers\\IndexController", "method"=>"index"],
# ['key'=>'', 'router'=>'application/config/routes-cli/routes.php'],
# ['key'=>'', 'router'=>'config/routes-cli/routes.php'],
# ['key'=>'/', 'router'=>[]],
return [

View File

@@ -5,9 +5,9 @@
# Example:
# ['key'=>'/', "action"=>"App\\Main\\Controllers\\IndexController", "method"=>"index"],
# ['key'=>'/', 'router'=>'application/config/routes/main/routes.php'],
# ['key'=>'/', 'router'=>'config/routes/main/routes.php'],
# ['key'=>'/', 'router'=>[]],
return [
['key'=>'/', 'router'=>'application/config/routes/routes.php'],
['key'=>'/', 'router'=>'config/routes/routes.php'],
];

View File

@@ -4,17 +4,17 @@ return [
/**
* Путь к файлу фабрики возвращающий реализацию RouterInterface или сам экземпляр класса
*/
\Rmphp\Foundation\RouterInterface::class => 'application/config/components/routerFactory.php',
\Rmphp\Foundation\RouterInterface::class => 'config/components/routerFactory.php',
/**
* Путь к файлу фабрики возвращающий реализацию TemplateInterface или сам экземпляр класса
*/
\Rmphp\Foundation\TemplateInterface::class => 'application/config/components/templateFactory.php',
\Rmphp\Foundation\TemplateInterface::class => 'config/components/templateFactory.php',
/**
* Путь к файлу фабрики возвращающий реализацию PSR-3 LoggerInterface или сам экземпляр класса
*/
\Psr\Log\LoggerInterface::class => 'application/config/components/loggerFactory.php',
\Psr\Log\LoggerInterface::class => 'config/components/loggerFactory.php',
/**
* Путь к файлу фабрики возвращающий реализацию PSR-11 ContainerInterface или сам экземпляр класса
*/
\Psr\Container\ContainerInterface::class => 'application/config/components/containerFactory.php',
\Psr\Container\ContainerInterface::class => 'config/components/containerFactory.php',
];

View File

@@ -2,18 +2,18 @@
use DI\ContainerBuilder;
$containerIni = (getenv("CONTAINER_INI")) ?: "application/config/container.php";
$containerIni = (getenv("CONTAINER_INI")) ?: "config/container.php";
$containerCache = (getenv("CONTAINER_CACHE")) ?: "var/cache/container";
$dependencies = require dirname(__DIR__,3).'/'.$containerIni;
$dependencies = require dirname(__DIR__,2).'/'.$containerIni;
$dependenciesCollection = array_map(function ($dependenciesFile){
return require dirname(__DIR__,3)."/".$dependenciesFile;
return require dirname(__DIR__,2)."/".$dependenciesFile;
}, $dependencies);
try {
$builder = new ContainerBuilder();
if(getenv("APP_MODE") == "PROD") $builder->enableCompilation(dirname(__DIR__,3)."/".$containerCache);
if(getenv("APP_MODE") == "PROD") $builder->enableCompilation(dirname(__DIR__,2)."/".$containerCache);
$builder->addDefinitions(array_replace_recursive(...$dependenciesCollection));
return $builder->build();
} catch (Exception $e) {echo $e->getMessage();}

View File

@@ -1,2 +1,2 @@
<?php
return (new \Monolog\Logger('system'))->pushHandler(new \Monolog\Handler\StreamHandler(dirname(__DIR__, 3).'/var/logs/log'.date('Ymd').'.log'));
return (new \Monolog\Logger('system'))->pushHandler(new \Monolog\Handler\StreamHandler(dirname(__DIR__, 2).'/var/logs/log'.date('Ymd').'.log'));

5
config/container.php Normal file
View File

@@ -0,0 +1,5 @@
<?php
return [
"config/container/services.php",
"config/container/settings.php",
];

View File

@@ -4,7 +4,7 @@ use Rmphp\Storage\Mysql\MysqlStorage;
use Rmphp\Storage\Mysql\MysqlStorageInterface;
return [
MysqlStorageInterface::class => DI\create(MysqlStorage::class)->constructor(json_decode(getenv("MYSQL_PARAM"), true)),
MysqlStorageInterface::class => DI\create(MysqlStorage::class)->constructor(json_decode(getenv("MYSQL_PARAM"))),
'App\Domain\Repository\*RepositoryInterface' => DI\autowire('App\Infrastructure\Repository\*Repository'),
'App\*\Domain\Repository\*RepositoryInterface' => DI\autowire('App\*\Infrastructure\Repository\*Repository'),
];

View File

@@ -1,6 +1,6 @@
<?php
$cashFile = preg_replace("'.application.*$'",'', __DIR__).'/var/routes/'.md5(__FILE__);
$cashFile = dirname(__DIR__,2).'/var/routes/'.md5(__FILE__);
if(getenv("APP_MODE") == "PROD" && file_exists($cashFile)){
return unserialize(file_get_contents($cashFile));

View File

@@ -8,7 +8,7 @@
namespace App\Infrastructure\Handlers;
use Base\Controllers\AbstractHandler;
use Base\Handlers\AbstractHandler;
use Psr\Http\Message\ResponseInterface;
class IndexHandler extends AbstractHandler {