Factory for creating HTTP transporters.
Description
Uses HTTPlug’s Discovery component to automatically find available HTTP clients and factories.
Methods
| Name | Description |
|---|---|
| HttpTransporterFactory::createTransporter | Creates an HTTP transporter. |
Source
class HttpTransporterFactory
{
/**
* Creates an HTTP transporter.
*
* Uses HTTPlug Discovery to automatically find PSR-18 client
* and PSR-17 factories if not provided.
*
* @since 0.1.0
*
* @return HttpTransporterInterface The HTTP transporter.
*/
public static function createTransporter(): HttpTransporterInterface
{
return new \WordPress\AiClient\Providers\Http\HttpTransporter(Psr18ClientDiscovery::find(), Psr17FactoryDiscovery::findRequestFactory(), Psr17FactoryDiscovery::findStreamFactory());
}
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.