drewlabs/net 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drewlabs/net

最新稳定版本:v0.2.2

Composer 安装命令:

composer require drewlabs/net

包简介

Networking utilities libraries

README 文档

README

This package provide developper with networking utilities.

Note: The package is under development and APIs are subject to changes.

Usage

Ping request

Ping clients provide developper with a unified interface for querying server existence using ping cli, php socket api or the generic PHP fsocketopen utility function. When using OS Ping binary to perform query, you are required to sanitize the data send through the comminication channel as these clients are often insecure for sensitve data. Prefer use of the Ping client as it's often fast that the php implementations. Default: Binary

// Import required classes & functions
use Drewlabs\Net\Client;
use Drewlabs\Net\Method;

// Create a PING client
$client = new Drewlabs\Net\Pring(<HOST>, [<PORT>, <TMIEOUT>]);
// example
$client = new Drewlabs\Net\Pring('https://liksoft.tg');

// Send request using default Channel
$response = $client->request(); // Returns \Drewlabs\Net\PingResult class
// Send a Ping request using PHP fsockopen util
$response = $client->request(Method::FSOCKOPEN);


// Get response details
$response->latency(); // Returns the latency of the PING request
$response->ip(); // Returns the IP address of the client

Extras

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-11