Download the PHP package tuuz/net without Composer
On this page you can find all versions of the php package tuuz/net. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package net
Short Description TuuzNet is a lightweight cURL-based HTTP client library for PHP. Provides clean static interface for GET, POST (JSON/Form/File/Binary), PUT, DELETE requests with customizable headers, timeouts, and SSL configuration.
License MIT
Homepage https://github.com/tobycroft/php_tuuz_net
Informations about the package net
TuuzNet
轻量级 cURL 基础的 PHP HTTP 客户端库,提供简洁的静态接口,支持 GET、POST(JSON/Form/File/Binary)、PUT、DELETE 等常见请求方式。
功能特性
- ✅
GET/POST/PUT/DELETE常用请求方法 - ✅ JSON 请求 (
PostJson) - ✅ 表单请求 (
PostForm) - ✅ 文件上传 (
PostFile) - ✅ 二进制流传输 (
PostBinary) - ✅ 自定义 Header、超时、Query 参数
- ✅ 完整异常处理与超时检测
- ✅ 默认禁用 SSL 校验(内网/调试友好)
- ✅ 零依赖,仅需
ext-curl+ext-json - ✅ 内置 Conventional Commits 提交信息分析器,可自动生成包描述、版本号建议、CHANGELOG
安装
通过 Composer 安装:
要求:
- PHP >= 8.0
- 扩展:
curl,json
快速开始
💡 也可以直接用全局类名
TuuzNet::xxx()调用(无需use导入,由 helpers.php 自动注册 class_alias)。
API 参考
所有方法均为静态调用,抛出 \Exception 用于错误和超时处理。
通用参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
$base_url / $send_url / $url |
string |
请求目标 URL |
$query |
array |
URL Query 参数(会以 ?a=1&b=2 拼接到 URL) |
$postData |
array | string |
请求体数据 |
$headers |
array |
自定义 HTTP Header(字符串数组,格式 Key: value) |
$timeout |
int |
超时时间(秒),默认 30~60 秒 |
Get()
PostJson()
以 Content-Type: application/json 发送 POST 请求,$postData 数组会自动 json_encode(使用 JSON_UNESCAPED_UNICODE)。
PostForm()
以 application/x-www-form-urlencoded 发送表单 POST。
PostFile()
使用 multipart/form-data 上传文件,基于 PHP 原生 CURLFile。
示例:上传文件并携带额外字段
PostBinary()
发送二进制数据(例如图片字节流、protobuf)。返回结构包含响应、错误、HTTP 元信息。
返回值:
Put()
发送 PUT 请求,默认 JSON 编码。
Delete()
发送 DELETE 请求。
错误处理
所有请求在失败时均抛出 \Exception:
CommitAnalyzer - 提交信息分析器
本包内置基于 Conventional Commits 规范的提交分析器,可自动分析 Git 日志、生成版本号建议、CHANGELOG、以及包提交用的 Description。
直接使用(CLI)
输出包含:有效性统计、按类型/Scope分布图、无效提交提示、自动生成的包描述(Summary/Keywords/Highlights)、完整 CHANGELOG。
代码调用
支持的 Conventional Commits Type
| type | 说明 |
|---|---|
| feat | 新增功能 |
| fix | 修复 bug |
| docs | 文档变更 |
| style | 代码风格(非功能) |
| refactor | 重构 |
| perf | 性能优化 |
| test | 测试相关 |
| build | 构建系统 |
| ci | CI/CD 配置 |
| chore | 杂项维护 |
| revert | 回滚 |
示例提交:
目录结构
License
MIT License © tobycroft
All versions of net with dependencies
ext-curl Version *
ext-json Version *