From c77ca46395a5ea6fa436a66c7c2fcc0c196cd3c7 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sun, 29 Jan 2023 01:49:54 +0800 Subject: [PATCH] Adapterman --- composer.json | 7 +-- composer.lock | 140 ++++++++++++++++++++++++++++++++++++++++++++++++-- server.php | 33 ++++++++++++ 3 files changed, 173 insertions(+), 7 deletions(-) create mode 100644 server.php diff --git a/composer.json b/composer.json index 4289229..e34901e 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,10 @@ "license": "MIT", "require": { "php": "^8.2", + "ext-bcmath": "*", "ext-openssl": "*", "ext-pcntl": "*", + "ext-pdo": "*", "ext-posix": "*", "ext-zip": "^1.19", "doctrine/dbal": "^3.4", @@ -19,6 +21,7 @@ "genealabs/laravel-model-caching": "^0.12.5", "guzzlehttp/guzzle": "^7.2", "jenssegers/mongodb": "^3.9", + "joanhey/adapterman": "^0.5.5", "laravel/framework": "^9.19", "laravel/octane": "^1.3", "laravel/sanctum": "^3.0", @@ -30,9 +33,7 @@ "spatie/laravel-tags": "^4.3", "spiral/roadrunner": "^2.8.2", "symfony/psr-http-message-bridge": "^2.1", - "yansongda/laravel-pay": "~3.2.0", - "ext-bcmath": "*", - "ext-pdo": "*" + "yansongda/laravel-pay": "~3.2.0" }, "require-dev": { "beyondcode/laravel-query-detector": "^1.6", diff --git a/composer.lock b/composer.lock index 933127e..5e3cef3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f5b5e44969a1c7da4ff92e7372037407", + "content-hash": "7cdf1f58081bceb75c91bcacfc8d51a8", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1959,6 +1959,69 @@ ], "time": "2023-01-16T20:14:17+00:00" }, + { + "name": "joanhey/adapterman", + "version": "0.5.5", + "source": { + "type": "git", + "url": "https://github.com/joanhey/AdapterMan.git", + "reference": "ada51bcc0cc7f8fc38e51f6e19ec1cca99f2092c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joanhey/AdapterMan/zipball/ada51bcc0cc7f8fc38e51f6e19ec1cca99f2092c", + "reference": "ada51bcc0cc7f8fc38e51f6e19ec1cca99f2092c", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": "^8", + "workerman/workerman": "^3.5" + }, + "suggest": { + "ext-event": "For better performance. " + }, + "type": "library", + "autoload": { + "psr-4": { + "Adapterman\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joanhey", + "email": "joanhey@kumbiaphp.com", + "homepage": "https://kumbiaphp.com", + "role": "Developer" + } + ], + "description": "Use any framework and application with Workerman.", + "keywords": [ + "event", + "php", + "workerman" + ], + "support": { + "issues": "https://github.com/joanhey/adapterman/issues", + "source": "https://github.com/joanhey/adapterman" + }, + "funding": [ + { + "url": "https://github.com/joanhey", + "type": "github" + } + ], + "time": "2022-12-23T02:12:55+00:00" + }, { "name": "laminas/laminas-diactoros", "version": "2.24.0", @@ -8677,6 +8740,75 @@ }, "time": "2022-06-03T18:03:27+00:00" }, + { + "name": "workerman/workerman", + "version": "v3.5.34", + "source": { + "type": "git", + "url": "https://github.com/walkor/workerman.git", + "reference": "fe4fc5ecc44d0410a22214d9e8679e2fc3795f5a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/workerman/zipball/fe4fc5ecc44d0410a22214d9e8679e2fc3795f5a", + "reference": "fe4fc5ecc44d0410a22214d9e8679e2fc3795f5a", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3" + }, + "suggest": { + "ext-event": "For better performance. " + }, + "type": "library", + "autoload": { + "psr-4": { + "Workerman\\": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "walkor", + "email": "walkor@workerman.net", + "homepage": "http://www.workerman.net", + "role": "Developer" + } + ], + "description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.", + "homepage": "http://www.workerman.net", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "email": "walkor@workerman.net", + "forum": "http://wenda.workerman.net/", + "issues": "https://github.com/walkor/workerman/issues", + "source": "https://github.com/walkor/workerman", + "wiki": "http://doc.workerman.net/" + }, + "funding": [ + { + "url": "https://opencollective.com/workerman", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/walkor", + "type": "patreon" + } + ], + "time": "2022-12-16T02:47:08+00:00" + }, { "name": "yansongda/laravel-pay", "version": "v3.2.1", @@ -11834,12 +11966,12 @@ "prefer-lowest": false, "platform": { "php": "^8.2", + "ext-bcmath": "*", "ext-openssl": "*", "ext-pcntl": "*", + "ext-pdo": "*", "ext-posix": "*", - "ext-zip": "^1.19", - "ext-bcmath": "*", - "ext-pdo": "*" + "ext-zip": "^1.19" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/server.php b/server.php new file mode 100644 index 0000000..0dc298e --- /dev/null +++ b/server.php @@ -0,0 +1,33 @@ +make(Illuminate\Contracts\Http\Kernel::class); + +$http_worker = (new Worker('http://0.0.0.0:8080')); +$http_worker->count = 8; +$http_worker->name = 'AdapterMan'; + +$http_worker->onMessage = static function (TcpConnection $connection) use ($kernel) { + ob_start(); + + $response = $kernel->handle( + $request = Illuminate\Http\Request::capture() + ); + + + $response->send(); + + $kernel->terminate($request, $response); + + $connection->send(ob_get_clean()); +}; + +Worker::runAll();