From 5af9f0a14f0cc570fe127ed289016fc27f1d47b1 Mon Sep 17 00:00:00 2001 From: Foma Date: Thu, 12 Dec 2024 18:00:31 +0300 Subject: [PATCH 1/3] [PHP]: hleb2-workerman added --- .../app/Bootstrap/BaseContainer.php | 14 +++++++++++++ .../app/Bootstrap/ContainerFactory.php | 13 ++++++++++++ .../app/Bootstrap/ContainerInterface.php | 9 ++++++++ php/hleb2-workerman/composer.json | 12 +++++++++++ php/hleb2-workerman/config.yaml | 14 +++++++++++++ php/hleb2-workerman/config/database.php | 6 ++++++ php/hleb2-workerman/config/main.php | 9 ++++++++ php/hleb2-workerman/config/system.php | 20 ++++++++++++++++++ php/hleb2-workerman/console | 5 +++++ php/hleb2-workerman/public/index.php | 21 +++++++++++++++++++ php/hleb2-workerman/routes/map.php | 5 +++++ 11 files changed, 128 insertions(+) create mode 100644 php/hleb2-workerman/app/Bootstrap/BaseContainer.php create mode 100644 php/hleb2-workerman/app/Bootstrap/ContainerFactory.php create mode 100644 php/hleb2-workerman/app/Bootstrap/ContainerInterface.php create mode 100644 php/hleb2-workerman/composer.json create mode 100644 php/hleb2-workerman/config.yaml create mode 100644 php/hleb2-workerman/config/database.php create mode 100644 php/hleb2-workerman/config/main.php create mode 100644 php/hleb2-workerman/config/system.php create mode 100644 php/hleb2-workerman/console create mode 100644 php/hleb2-workerman/public/index.php create mode 100644 php/hleb2-workerman/routes/map.php diff --git a/php/hleb2-workerman/app/Bootstrap/BaseContainer.php b/php/hleb2-workerman/app/Bootstrap/BaseContainer.php new file mode 100644 index 00000000000..6a1baad86e9 --- /dev/null +++ b/php/hleb2-workerman/app/Bootstrap/BaseContainer.php @@ -0,0 +1,14 @@ +=8.2.0", + "phphleb/framework": "~2.0.0", + "workerman/workerman": "^5.0 || ^4.0" + }, + "autoload": { + "classmap": [ + "app/" + ] + } +} diff --git a/php/hleb2-workerman/config.yaml b/php/hleb2-workerman/config.yaml new file mode 100644 index 00000000000..e721ef7ea78 --- /dev/null +++ b/php/hleb2-workerman/config.yaml @@ -0,0 +1,14 @@ +framework: + website: hleb2framework.ru + github: phphleb/hleb + version: 2.0 + + files: + - console + + bootstrap: + - php console --generate-key + - php console --routes-upd + + engines: + - workerman diff --git a/php/hleb2-workerman/config/database.php b/php/hleb2-workerman/config/database.php new file mode 100644 index 00000000000..1ff964737e4 --- /dev/null +++ b/php/hleb2-workerman/config/database.php @@ -0,0 +1,6 @@ + 'mysql.name', + 'db.settings.list' => [] +]; diff --git a/php/hleb2-workerman/config/main.php b/php/hleb2-workerman/config/main.php new file mode 100644 index 00000000000..e55e6f45ebb --- /dev/null +++ b/php/hleb2-workerman/config/main.php @@ -0,0 +1,9 @@ + 'en', + 'allowed.languages' => ['en'], + 'session.enabled' => false, + 'db.log.enabled' => false, + 'session.options' => [], +]; diff --git a/php/hleb2-workerman/config/system.php b/php/hleb2-workerman/config/system.php new file mode 100644 index 00000000000..d8730ab5269 --- /dev/null +++ b/php/hleb2-workerman/config/system.php @@ -0,0 +1,20 @@ + ['logs' => '/storage/logs'], + 'classes.autoload' => true, + 'origin.request' => false, + 'ending.slash.url' => 0, + 'ending.url.methods' => ['get'], + 'url.validation' => false, + 'session.name' => 'PHPSESSID', + 'max.session.lifetime' => 0, + 'allowed.route.paths' => [], + 'allowed.structure.parts' => [], + 'page.external.access' => true, + 'module.dir.name' => 'modules', + 'custom.function.files' => [], + 'custom.setting.files' => [], + 'events.used' => false, + 'async.clear.state' => false, +]; diff --git a/php/hleb2-workerman/console b/php/hleb2-workerman/console new file mode 100644 index 00000000000..9265085e424 --- /dev/null +++ b/php/hleb2-workerman/console @@ -0,0 +1,5 @@ +count = shell_exec('nproc') ?: 32; + +$server->onMessage = function (TcpConnection $connection, $request) use ($framework) { + $res = $framework->load($request)->getResponse(); + + $connection->send(new Response($res->getStatus(), $res->getHeaders(), $res->getBody())); +}; + +Worker::runAll(); diff --git a/php/hleb2-workerman/routes/map.php b/php/hleb2-workerman/routes/map.php new file mode 100644 index 00000000000..0428e77ddf4 --- /dev/null +++ b/php/hleb2-workerman/routes/map.php @@ -0,0 +1,5 @@ + Date: Thu, 12 Dec 2024 18:12:41 +0300 Subject: [PATCH 2/3] [PHP]: fix hleb2-workerman --- php/hleb2-workerman/config/common.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 php/hleb2-workerman/config/common.php diff --git a/php/hleb2-workerman/config/common.php b/php/hleb2-workerman/config/common.php new file mode 100644 index 00000000000..9e6093fec0b --- /dev/null +++ b/php/hleb2-workerman/config/common.php @@ -0,0 +1,21 @@ + false, + 'log.enabled' => false, + 'max.log.level' => 'info', + 'max.cli.log.level' => 'info', + 'log.level.in-cli' => false, + 'error.reporting' => E_ALL, + 'log.sort' => true, + 'log.stream' => false, + 'log.format' => 'row', + 'log.db.excess' => 0, + 'timezone' => 'UTC', + 'routes.auto-update' => false, + 'container.mock.allowed' => false, + 'app.cache.on' => false, + 'show.request.id' => false, + 'max.log.size' => 0, + 'max.cache.size' => 0, +]; From cbc340929ca2c881564176e36c7007d015e55f9a Mon Sep 17 00:00:00 2001 From: Foma Date: Thu, 12 Dec 2024 20:30:35 +0300 Subject: [PATCH 3/3] [PHP]: hleb2-workerman - update workerman version --- php/hleb2-workerman/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/hleb2-workerman/composer.json b/php/hleb2-workerman/composer.json index 13e8d82d150..733343e33f4 100644 --- a/php/hleb2-workerman/composer.json +++ b/php/hleb2-workerman/composer.json @@ -2,7 +2,7 @@ "require": { "php": ">=8.2.0", "phphleb/framework": "~2.0.0", - "workerman/workerman": "^5.0 || ^4.0" + "workerman/workerman": "@stable" }, "autoload": { "classmap": [