Looking to hire Laravel developers? Try LaraJobs

http-client-for-laravel maintained by tuki

Description
Laravel adapter package for tuki/http-client.
Last update
2026/03/18 01:32 (dev-main)
License
Links
Downloads
1

Comments
comments powered by Disqus

tuki/http-client-for-laravel

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)