Registry / networking / amphp-socket

amphp-socket

JSON →
library2.4.0phppackagistunverified

Non-blocking socket connection / server implementations based on Amp and Revolt.

composer require amphp/socket
INSTALL
IMPORT
SIG · AMPHP-SOCKET
A
amphp-socket
networkingphpv2.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Socket
use Amp\Socket\Socket;

Creates a non-blocking socket connection and reads data asynchronously.

use Amp\Socket\Socket; use function Amp\async; $socket = Socket::connect('tcp://example.com:80'); $response = async(fn() => $socket->read());
Debug
Known issues
gotchaRequires the Revolt event loop to be running; otherwise, operations may hang.
fix
Ensure you have an event loop (e.g., Amp\Loop::run()) before using sockets.
affects: >=2.0.0
Upgrade
Version history
2.4.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
39 hits · last 30 days
node
34
Resources
amphp-socket — pip install amphp-socket · libregistry