hollodotme / fast-cgi-client
A PHP fast CGI client to send requests (a)synchronously to PHP-FPM.
Fund package maintenance!
Requires
- php: >=8.0
- ext-fileinfo: *
- ext-json: *
Requires (Dev)
- ext-xdebug: >=3.1
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- v4.0.0
- v3.1.8
- v3.1.7
- v3.1.6
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v3.0.0-beta
- v3.0.0-alpha
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- dev-4.x-dev
- dev-4.x-stable
- dev-3.x-dev
- dev-3.x-stable
- dev-fix/stream-select-without-busy-sockets
- dev-fix/backport-4.x-fixes
- dev-chore/refresh-docs-daily
- dev-feature/website-redesign
- dev-fix/review-findings
- dev-feature/docs-animations-2
- dev-feature/docs-animations
- dev-feature/docs-website
- dev-chore/quiet-tooling
- dev-docs/response-size
- dev-fix/ci-and-decoding
- dev-fix/client-reading
- dev-fix/socket-protocol
- dev-fix/no-http-status-line
- dev-chore/compatibility-workflows
- dev-fix/response-parsing
- dev-feature/32-compatibility-java
- dev-feature/31-compatibility-csharp
- dev-feature/29-compatibility-rust
- dev-feature/30-compatibility-go
- dev-chore/add-phpcs
- dev-fix/stale-content-length
- dev-chore/upgrade-github-actions
- dev-fix/validate-fastcgi-packets
- dev-feature/87-docs-changelog-4.0
- dev-feature/85-php-8-language-features
- dev-feature/86-deterministic-integration-tests
- dev-feature/84-retry-requests
- dev-feature/83-query-params
- dev-feature/82-configurable-stream-select-timeout
- dev-feature/81-require-ext-fileinfo
- dev-development
- dev-2.x-stable
- dev-2.x-dev
- dev-research/use-idle-sockets
- dev-1.x-stable
- dev-1.x-dev
- dev-release/3.0.0
- dev-feature/reactive-loop
This package is auto-updated.
Last update: 2026-10-05 12:12:58 UTC
README
Fast CGI Client
A PHP fast CGI client to send requests (a)synchronously to PHP-FPM using the FastCGI Protocol.
This library is based on the work of Pierrick Charron's PHP-FastCGI-Client and was ported and modernized to latest PHP versions, extended with some features for handling multiple requests (in loops) and unit and integration tests as well.
📖 Documentation
The full documentation is available at fast-cgi-client.hollo.me.
- What it is
- Installation
- Getting started
- Use cases & examples — connections, single requests, multiple requests, requests, responses, exceptions, trouble shooting
- API reference
Versions
This is version 4.x, which requires PHP >= 8.0.
Please have a look at the backwards incompatible changes (BC breaks) in the changelog, if you upgrade from a previous version.
| Version | PHP | Documentation | Changelog |
|---|---|---|---|
| 4.x | >= 8.0 | 4.x | CHANGELOG.md |
| 3.x | >= 7.1 | 3.x | 3.x |
| 2.x | >= 7.1 | 2.x | 2.x |
| 1.x | >= 7.0 | 1.x | 1.x |
Version 3.x still gets bug fixes, but no new features.
Installation
composer require hollodotme/fast-cgi-client
Quick example
<?php declare(strict_types=1); use hollodotme\FastCGI\Client; use hollodotme\FastCGI\RequestContents\UrlEncodedFormData; use hollodotme\FastCGI\Requests\PostRequest; use hollodotme\FastCGI\SocketConnections\NetworkSocket; $client = new Client(); $connection = new NetworkSocket( '127.0.0.1', 9000 ); $request = new PostRequest( '/path/to/target/script.php', new UrlEncodedFormData( ['key' => 'value'] ) ); $response = $client->sendRequest( $connection, $request ); echo $response->getBody();
Sending requests asynchronously, reacting to responses with callbacks, streaming output and much more is described in the documentation.
Contributing
Contributions are welcome, please read the contribution guide. It also describes how to run the tests, the static analysis and the documentation website locally.
License
The FastCGI Client is released under the MIT License.