Integration

FastForward HTTP Client is intentionally small. It registers a transport entry point and a PSR-18 adapter, then relies on the surrounding container composition to provide the PSR-17 collaborators required by that adapter.

Dependency Graph

The main service resolution path looks like this:

Psr\Http\Client\ClientInterface
    -> Symfony\Component\HttpClient\Psr18Client
        -> Symfony\Component\HttpClient\HttpClient::class
        -> Psr\Http\Message\ResponseFactoryInterface
        -> Psr\Http\Message\StreamFactoryInterface

This means the provider is complete only when your container can already resolve the two PSR-17 factory interfaces.

Registration With The Container Helper

use FastForward\Http\Client\ServiceProvider\HttpClientServiceProvider;
use FastForward\Http\Message\Factory\ServiceProvider\HttpMessageFactoryServiceProvider;

use function FastForward\Container\container;

$container = container(
    new HttpMessageFactoryServiceProvider(),
    new HttpClientServiceProvider(),
);

Because container() resolves sources from left to right, the order of your providers matters when you later start overriding services. See Overriding Services for the details.

Using The Package Outside FastForward Container

The package exports an Interop\Container\ServiceProviderInterface implementation. It plugs in directly only where that interface is understood.

If your application uses another PSR-11 container, you have two main options:

  • translate the two service registrations into that container's native format;
  • compose this provider through a FastForward container layer that your application consumes as a PSR-11 container.

Common Integration Mistake

If you see an error related to missing ResponseFactoryInterface or StreamFactoryInterface , the HTTP client provider itself is usually not the problem. The missing piece is almost always the PSR-17 factory provider that should have been registered before it.