Skip to content

[FEATURE] Add a PSR HttpClient Builder #409

Description

@alexander-schranz

Is your feature request related to a problem?

I got this week a Pull Request to SEAL here: PHP-CMSIG/search#697 which mentino deprecation of the old ClientBuilder.

But I must say in PHP a library today should more relay on the PSR HTTP Client Standard to make it as easy as possible and not longer force specific HTTP Clients in general libraries.

What solution would you like?

A related PSR Client is easy to create example:

$httpClient = HttpClientDiscovery::find();

I'm not sure what was the move behind to have Symfony and Guzzle clients.

But the PSR Http Client Discovery would choose the client which best fits the framework the user uses Symfony, Laravel, ... by check what is there and create a PSR compatible client out of it so a library don't need to care about Symfony Http Client, Guzzle Http Client, ...

$client = (new PsrClientFactory())->create([
     'base_uri' => 'http://127.0.0.1:9200',
]);

What alternatives have you considered?

Currently as a library which need support multiple Frameworks I would require to choose one specific one if Opensearch Stays have 2 types of Builders for specific clients.

I recommend making things easier and only provide 1 way always go with a PSR clients.

Do you have any additional context?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions