定制 tuki/http-client-for-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tuki/http-client-for-laravel

最新稳定版本:v1.0.3

Composer 安装命令:

composer require tuki/http-client-for-laravel

包简介

Laravel adapter package for tuki/http-client.

README 文档

README

Laravel integration layer for tuki/http-client. Adds auto-discovery, a facade, database persistence, async sink dispatch, framework events, and first-class test support — all wired to the Laravel container.

Profiles can also define reusable authentication through seal providers, so a bearer token or HTTP Basic setup lives in config and is applied automatically to every request sent through that profile.

Requirements

  • PHP: 7.4.* || 8.*
  • Laravel: >= 8.0
  • PHP extensions: ext-curl, ext-json
  • Core dependency: tuki/http-client:^1.0

Installation

composer require tuki/http-client-for-laravel

Publish config and migrations, then migrate:

php artisan vendor:publish --provider="Tuki\HttpClientForLaravel\TukiHttpClientForLaravelServiceProvider" --tag=config
php artisan vendor:publish --provider="Tuki\HttpClientForLaravel\TukiHttpClientForLaravelServiceProvider" --tag=migrations
php artisan migrate

Define your first profile in config/tuki_http_client.php:

'default_profile' => 'pokemon_api',

'profiles' => [
    'pokemon_api' => [
        'base_uri' => 'https://pokeapi.co/api/v2',
        'timeout' => 20,
        'connect_timeout' => 10,
    ],
],

Send a request via the facade:

use Tuki\HttpClientForLaravel\Facades\HttpClient;

$response = HttpClient::newRequest('pokemon.search')
    ->to('GET', '/pokemon/pikachu')
    ->expectsJson()
    ->execute();

$payload = $response->getJsonData();

→ For a complete setup walkthrough, see Installation and first success.

Documentation

License

MIT. See LICENSE.

Validation

composer test
composer stan
composer coverage

From the workspace root, the recommended execution path is the root Makefile:

make laravel-qa
make laravel-coverage

Inside this package, use Makefile targets directly. They support both local Docker and CI/direct execution:

make qa                 # local default: Docker mode
make qa USE_DOCKER=0    # CI/direct mode (no docker compose wrapper)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-15