Search by

hollodotme / fast-cgi-client

hollodotme

A PHP fast CGI client to send requests (a)synchronously to PHP-FPM.

Package info

github.com/hollodotme/fast-cgi-client

pkg:composer/hollodotme/fast-cgi-client

Fund package maintenance!

hollodotme

Statistics

Installs: 29 910 507

Dependents: 25

Suggesters: 0

Stars: 564

Open Issues: 16

v4.0.0 2026-10-05 12:05 UTC

README

FastCGI Client CI PHP 8.0 - 8.5 Latest Stable Version Total Downloads Compatible with Go FastCGI server Compatible with Rust FastCGI server Compatible with Rust FastCGI server (tokio) Compatible with C# FastCGI server Compatible with Java FastCGI server Documentation

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.

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.