fast-forward / http-client
Fast Forward PSR-18 HTTP Client Factory
v1.0.0
2025-06-12 17:26 UTC
Requires
- php: ^8.1
- container-interop/service-provider: ^0.4.1
- fast-forward/container: ^1.4
- psr/http-client: ^1.0
- psr/http-factory: ^1.1
- symfony/http-client: ^7.3
Requires (Dev)
- coisa/php-cs-fixer: ^2.1
- phpspec/prophecy-phpunit: ^2.3
- phpunit/phpunit: ^9.6 || ^10.5 || ^11.5
This package is auto-updated.
Last update: 2025-06-12 17:28:41 UTC
README
🚀 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.
📦 Installation
composer require fast-forward/http-client
✅ Features
- 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
🛠️ Usage
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);
🔧 Services Registered
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 |
📂 License
This package is open-source software licensed under the MIT License.
🤝 Contributing
Contributions, issues, and feature requests are welcome!
Feel free to open a GitHub Issue or submit a Pull Request.