larexsetch/http-client-binder

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v1.0) of this package.

Http client binder is easy way to create http client

v1.0 2019-12-30 13:45 UTC

README

GitHub Actions status | larexsetch/http-client-binder

This library creates simple way bind the interface and http call to foreign endpoint

Installation

composer require larexsetch/http-client-binder

Create client interface

You can see example here: HttpClientBinder\Tests\Base\Client\ClientInterface

Build the client

<?php

/** @var YourClientInterface $client */
$client = 
    \HttpClientBinder\Fabrics\BinderBuilder::builder()
        ->temporaryDirectory("/path/to/temporary/directory") // Default /tmp
        ->encoder($encoder) // Custom encoder 
        ->decoder($decoder) // Custom decoder
        ->target(YourClientInterface::class, $baseUrl) // $baseUrl may be declare by annotation @Client(baseUrl="http://example.com")
        ->getClient();