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": "@stable" + }, + "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/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, +]; 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 @@ +