🚀 FastForward HTTP Client
A PSR-11 compatible service provider that registers a fully functional set of PSR-18 HTTP client using Symfony HttpClient and Psr18Client.
Designed to work out of the box with the php-fast-forward/container
autowiring system.
composer require fast-forward/http-client
- Registers the default Symfony HttpClient using `HttpClient::create()
- Registers the PSR-18 Psr18Client with its dependencies injected
- Provides aliases for:
- Psr\Http\Client\ClientInterface
- Symfony\Component\HttpClient\HttpClient
If you’re using fast-forward/container
:
use FastForward\Container\container;
use FastForward\Config\ArrayConfig;
use FastForward\Container\ContainerInterface;
$config = new ArrayConfig([
ContainerInterface::class => [
// Reference the service provider by class name
FastForward\Http\Client\ServiceProvider\HttpClientServiceProvider::class,
],
]);
$container = container($config);
$client = $container->get(Psr\Http\Client\ClientInterface::class);
$response = $client->sendRequest($yourPsr7Request);
The following services will be automatically registered in your container when using HttpClientServiceProvider
:
Service Interface | Implementation Source |
---|---|
Symfony\Component\HttpClient\HttpClient |
Registered via MethodFactory::create() |
Psr\Http\Client\ClientInterface |
Symfony\Component\HttpClient\Psr18Client |
This package is open-source software licensed under the MIT License.
Contributions, issues, and feature requests are welcome!
Feel free to open a GitHub Issue or submit a Pull Request.