larexsetch / http-client-binder
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
Requires
- php: ^7.2
- doctrine/annotations: ^1.8
- guzzlehttp/guzzle: ~6.0
- jms/serializer: ^3.3
Requires (Dev)
- phpunit/phpunit: ^8.4
This package is auto-updated.
Last update: 2024-04-19 21:50:47 UTC
README
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();