From aebb0e96a9591225571cfcad533a7e4632129d3d Mon Sep 17 00:00:00 2001 From: Mikhail Ilinsky Date: Fri, 22 May 2026 12:24:36 +1000 Subject: [PATCH 1/3] docs: remove duplicated EventDrivenWorkerInterface example from Quick Start Quick Start now shows a minimal skeleton with a reference to the Worker Types section for the full implementation example. --- README.md | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index b8e3503..041581f 100644 --- a/README.md +++ b/README.md @@ -42,52 +42,26 @@ composer require duyler/worker-pool ## Quick Start -### Event-Driven Worker Mode (SharedSocketMaster + Server) +### Event-Driven Worker Mode This is the recommended mode for production HTTP servers. Each worker runs its own event loop with a full `Server` instance. The kernel distributes connections across workers via `SO_REUSEPORT`. ```php use Duyler\HttpServer\Config\ServerConfig; -use Duyler\HttpServer\Server; -use Duyler\HttpServer\ServerInterface; use Duyler\WorkerPool\Config\WorkerPoolConfig; use Duyler\WorkerPool\Master\MasterFactory; use Duyler\WorkerPool\Worker\EventDrivenWorkerInterface; -use Nyholm\Psr7\Response; - -final class MyApp implements EventDrivenWorkerInterface -{ - public function run(int $workerId, ServerInterface $server): void - { - // Do NOT call $server->start(). The master already manages sockets. - // Enable notification for reactive event loop wakeup - $server->enableNotification(); - $notifySocket = $server->getSocketResource(); - - // Polling example (see examples/ for reactive EvIo integration) - while (true) { - if ($server->hasRequest()) { - $requestData = $server->getRequest(); - if ($requestData !== null) { - $response = new Response(200, [], 'Hello from worker ' . $workerId); - $server->respond($requestData->respond($response)); - } - } - usleep(1000); - } - } -} +// Implement EventDrivenWorkerInterface (see Worker Types section for full example) +$worker = new MyApp(); // implements EventDrivenWorkerInterface $serverConfig = new ServerConfig(host: '0.0.0.0', port: 8080); $poolConfig = WorkerPoolConfig::auto($serverConfig); -// MasterFactory automatically picks the best architecture -// and creates the required DI wrappers (SocketWrapper, ForkWrapper, etc.) $master = MasterFactory::createRecommended( config: $poolConfig, serverConfig: $serverConfig, - eventDrivenWorker: new MyApp(), + eventDrivenWorker: $worker, ); $master->start(); // blocks until shutdown From 6ba4ce4e96464e585e8976a8679ecbe3ec33b0d7 Mon Sep 17 00:00:00 2001 From: Mikhail Ilinsky Date: Fri, 22 May 2026 12:28:17 +1000 Subject: [PATCH 2/3] chore: Up PHP version to 8.5 --- .github/workflows/ci.yml | 6 +++--- composer.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8276a4d..3035a11 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,12 +9,12 @@ jobs: runs-on: ubuntu-latest container: - image: duyler/php-zts:8.4 + image: duyler/php-zts:8.5 options: --user root strategy: matrix: - php-image: ['duyler/php-zts:8.4'] + php-image: ['duyler/php-zts:8.5'] steps: - name: Checkout @@ -35,7 +35,7 @@ jobs: - name: Update composer run: composer self-update - - name: Install dependencies with composer php 8.4 + - name: Install dependencies with composer php 8.5 run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with phpunit diff --git a/composer.json b/composer.json index 33a4280..a5e9623 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": "^8.4", + "php": "^8.5", "ext-sockets": "*", "ext-pcntl": "*", "ext-posix": "*", From e0b91f4b95c515eb9213501e63272249e6ba91d4 Mon Sep 17 00:00:00 2001 From: Mikhail Ilinsky Date: Fri, 22 May 2026 12:28:43 +1000 Subject: [PATCH 3/3] chore: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 041581f..d361f52 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Process manager with load balancing for Duyler Framework. ## Requirements -- PHP 8.4+ +- PHP 8.5+ - ext-sockets - ext-pcntl - ext-posix