puff / client
Fiber-aware TCP and TLS client transport for Puff
dev-main
2026-08-20 01:56 UTC
Requires
- php: ^8.2
- puff/async: dev-main
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-08-20 01:58:55 UTC
README
puff/client is Puff's protocol-neutral, Fiber-aware outbound transport. It provides non-blocking TCP/TLS connections for higher-level clients such as puff/http-client and a future puff/mqtt-client.
composer require puff/client
use Puff\Client\Connector; use Puff\Client\Endpoint; $connection = (new Connector())->connect(new Endpoint('example.com', 443, tls: true))->await(); $connection->handlers( onData: static fn (string $data) => print $data, onClose: static fn () => null, onError: static fn (Throwable $error) => throw $error, ); $connection->write("GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n");
The package deliberately does not implement HTTP, MQTT, retries, redirects, or protocol framing. Those responsibilities belong to protocol packages.