larexsetch / http-client-binder
Http client binder is easy way to create http client
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/larexsetch/http-client-binder
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-10-19 22:47:44 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();