From d16b10fa4504f45a4ede76c75f62d2a2a3b0f45f Mon Sep 17 00:00:00 2001 From: Luther Monson Date: Thu, 10 Sep 2026 23:32:54 -0700 Subject: [PATCH] docs: migrate worker config to [php.worker]; workers are threads; add CI - README/stub: [php] worker_populate_superglobals -> [php.worker] populate_superglobals - README: 'worker processes' -> worker threads (ZTS threads in one process; pool = [php] concurrency) - add GitHub Actions CI (composer install + phpunit on PHP 8.2/8.3/8.4) - native primitive stub signatures left unchanged (accurate) --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 8 +++++--- stubs/ephpm-worker.stub.php | 4 ++-- 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c83d7c4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + +permissions: + contents: read + +jobs: + test: + name: PHPUnit (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.2', '8.3', '8.4'] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer:v2 + + # The unit suite runs WITHOUT the native ePHPm engine: the Ephpm\Worker\* + # primitives are provided by test shims / the IDE stub, so `composer install` + # + phpunit is all that is needed. + - name: Install dependencies + run: composer install --prefer-dist --no-interaction --no-progress + + - name: Run PHPUnit + run: vendor/bin/phpunit diff --git a/README.md b/README.md index 3c21500..922ec42 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,10 @@ tagged `v0.1.0`, so `^0.1` resolves: ## What worker mode is When the ePHPm server runs with `[php] mode = "worker"`, it keeps a pool of -long-lived PHP worker processes alive and hands each HTTP request to a worker -via **native** primitives registered by the engine: +long-lived PHP worker **threads** alive and hands each HTTP request to a worker +via **native** primitives registered by the engine. (ePHPm is a single process; +each worker is a ZTS thread the engine owns — not a separate OS process — and the +pool is sized by `[php] concurrency`.) ```php namespace Ephpm\Worker; @@ -65,7 +67,7 @@ Contract notes: `bodyStream()` and PHP's POST reader — read it through only one of them. A stream stashed across requests returns EOF on the next request. - `parsedBody()`/`files()` are always `null`/empty: parse the body in your - adapter, or enable the `worker_populate_superglobals` config for PHP-native + adapter, or enable the `[php.worker] populate_superglobals` config for PHP-native `$_POST`/`$_FILES` population. - `exit()`/`die()` mid-request works — the engine synthesizes the response from SAPI headers plus captured echo output and recycles the worker — but pays a diff --git a/stubs/ephpm-worker.stub.php b/stubs/ephpm-worker.stub.php index af3e593..095f780 100644 --- a/stubs/ephpm-worker.stub.php +++ b/stubs/ephpm-worker.stub.php @@ -142,7 +142,7 @@ public function query(): array /** * Always returns `null`. Form/multipart parsing is an adapter concern — * parse {@see rawBody()}/{@see bodyStream()} yourself, or enable the - * `worker_populate_superglobals` config option for PHP-native + * `[php.worker] populate_superglobals` config option for PHP-native * `$_POST`/`$_FILES` population. * * @return array|null always null @@ -153,7 +153,7 @@ public function parsedBody(): ?array /** * Always returns an empty array. See {@see parsedBody()} — multipart - * parsing is an adapter concern (or the `worker_populate_superglobals` + * parsing is an adapter concern (or the `[php.worker] populate_superglobals` * config option). * * @return array always empty