Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.77 KB

File metadata and controls

50 lines (37 loc) · 1.77 KB

HTTP Client Adapters

For GenerationTarget::Client, the generator emits typed API clients with one of three HTTP transport styles.

Overview

Adapter Constructor Dependencies Request Method Good Choice For
HttpClientAdapter::SymfonyHttpClient Symfony\Contracts\HttpClient\HttpClientInterface request() Symfony apps and lightweight clients
HttpClientAdapter::Guzzle GuzzleHttp\ClientInterface request() + RequestOptions Existing Guzzle middleware stacks
HttpClientAdapter::Psr18 Psr\Http\Client\ClientInterface, request factory, stream factory sendRequest() Portable libraries and framework-neutral code

All adapters expose the same generated API signatures (*ApiClientInterface + *ApiClient).

Generated Files

generated/
|- Api/
|  |- PetsApiClientInterface.php
|  `- PetsApiClient.php
`- Model/
   |- Pet.php
   |- NewPet.php
   `- ...

Shared Runtime Behavior

  • path parameters are inserted without redundant concatenation fragments
  • nullable query params are omitted from the final request
  • request bodies use generated toArray() output
  • response payloads are mapped back via generated fromArray() methods
  • void operations still execute HTTP calls and skip response deserialization

Typical Configuration

use MaxBeckers\OpenApiGenerator\Config\GenerationTarget;
use MaxBeckers\OpenApiGenerator\Config\HttpClientAdapter;

$config->generationTarget = GenerationTarget::Client;
$config->httpClient = HttpClientAdapter::SymfonyHttpClient; // symfony|guzzle|psr18

Adapter-Specific Guides