tsaotai/tsaotai-helper

TsaoTai Helper Functions - 提供 pull HTTP请求 和 push 统一响应等工具函数

Maintainers

Package info

github.com/tsaotai/tsaotai-helper

pkg:composer/tsaotai/tsaotai-helper

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2026.1.1 2026-06-03 10:56 UTC

This package is auto-updated.

Last update: 2026-07-03 11:17:48 UTC


README

通用辅助函数包。

Version License

安装

composer require tsaotai/tsaotai-helper

函数列表

函数 说明
pull() HTTP 请求工具
push() 统一响应工具
uuid() 生成 UUID v4

使用示例

pull - HTTP 请求

// GET 请求
$result = pull('https://api.example.com/users', 'GET', ['page' => 1]);

// POST 请求
$result = pull('https://api.example.com/users', 'POST', [
    'name' => '张三',
    'email' => 'zhang@example.com'
]);

// 返回格式
// ['code' => 200, 'data' => [...], 'http_code' => 200]

push - 统一响应

// 成功响应
return push(0, '操作成功', $data);

// 失败响应
return push(404, '资源不存在');

// 返回格式
// {
//     "success": true,
//     "code": 0,
//     "message": "操作成功",
//     "data": [...],
//     "timestamp": 1685700000,
//     "request_id": "uuid-xxx",
//     "version": "1.0.0"
// }

uuid - 生成 UUID

$id = uuid();
// "a1b2c3d4-e5f6-7890-abcd-ef1234567890"

更新日志

查看 CHANGELOG.md

许可证

Apache-2.0 License