hhttp/io

用于http 接收与转发 日志留存

Maintainers

Details

github.com/kunyuH/hhttp

Source

Issues

Installs: 250

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

v1.1.17 2025-04-21 06:38 UTC

This package is auto-updated.

Last update: 2025-04-21 06:39:18 UTC


README

简介

各类io扩展

  • http
  • 日志记录

安装:

composer require hhttp/io

日志配置

filesystems.php 增加配置:

'debug'  => [
    'driver' => 'daily',
    'path'   => storage_path('logs/io/laravel.log'),
    'level'  => 'debug',
    'days'   => 30, # 保留30天 根据具体情况设置
],

http客户端调用(与GuzzleHttp用法一致;增加了请求日志记录)

$uri = config('http_service.inner_service') . '/api/test';
$res = (new HHttp())->post(
    uri: $uri,
    options: [
        'form_params' => $requestData
    ]
);
$data = $res->getBody()->getContents()
#----------------------------------------------------------------
$uri = config('http_service.inner_service') . '/api/test';
$res = (new HHttp())->post(
    uri: $uri,
    options: [
        'headers' => [
            'Content-Type' => 'application/json'
        ],
        'json' => [
            'card_no' => $account_id,
        ],
    ]
);
$data = $res->getBody()->getContents()

$uri = rtrim(config('apis.family_doctor.url'), DIRECTORY_SEPARATOR) . '/innerapi/xxx';
$res = (new HHttp())->get(
    uri: $uri,
    options: ['query' => $sign_data]
);
$data = json_decode($res->getBody()->getContents(),true);
- 配置收集的数据清理脚本
- \App\Console\Kernel::schedule方法中增加
```php
    # 应用hoo自定义的定时
    (new \hoo\io\common\Console\Kernel())->schedule($schedule);