codingpaws / layer4
Object-oriented PHP TCP/UDP connection manager
Installs: 3 316
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/codingpaws/layer4
Requires (Dev)
- nunomaduro/phpinsights: 9999999-dev
- phpunit/phpunit: ^9.5
README
layer4 is an object-oriented PHP TCP (and UDP) client manager that abstracts and simplifies network requests for you. 🤵
Getting started
Install layer4 by running composer require codingpaws/layer4
.
use CodingPaws\Layer4\ConnectionFactory;
$client = ConnectionFactory::tcp('example.com', '80');
$client->send("GET / HTTP/1.1\n");
$client->send("Host: example.com\n\n");
echo $client->read(1024 * 1024);
// Prints:
// HTTP/1.1 200 OK
// ...