codingpaws/layer4

面向对象的PHP TCP/UDP连接管理器

v2.1 2021-06-15 17:08 UTC

This package is auto-updated.

Last update: 2024-09-19 03:27:42 UTC


README

layer4 是一个面向对象的PHP TCP(和UDP)客户端管理器,它抽象并简化了网络请求。🤵

入门指南

通过运行 composer require codingpaws/layer4 来安装 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
//   ...