-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove locked dependency with guzzle 6 to allow any psr18 compatible http client #81
Remove locked dependency with guzzle 6 to allow any psr18 compatible http client #81
Conversation
Todo:
|
Hello @ppshobi, Using a fresh laravel install with laravel-scout using your PR, I have require only I have done some attempt with
|
Wow, Thank you @shokme for your support with testing, I will try to figure out why the other packages are having no luck with our sdk. |
So, I was missing some part when using $httpClient = new HttplugClient();
$client = new Client('http://127.0.0.1:7700', 'masterKey', $httpClient); The first error I have encounter was a missing dependency The header need to be fill only if About |
@shokme Please do the PR on the meili key Now, in an ideal situation, the user should install any psr18 compatible http client of choice, and they shouldn't init the client by themselves. But rather we should auto discover it and initialize it, that's the whole point of having interfaces. Since the PR for the initial implementation of http client (which depends on psr18 interfaces) included a default client of guzzle 6, we had to add this rewiring mechanism in case if we are using another client. I hope it makes sense. In production the installation should be,
So basically meilisearch-php is independent of any concrete implementation of http client, |
Also in laravel scout, I belive the end user should install |
Indeed, I have noticed the different Discovery inside the client. After adding $httpClient = new HttplugClient();
$client = new Client('http://127.0.0.1:7700', 'masterKey', $httpClient); But if you don't specify
Yes. |
So you are saying that if we add |
I haven't test all clients, but it allows I don't think we should add php-http/httplug, because of what they said in the intro
source: https://github.com/php-http/httplug/tree/v2.0.0 Right now, I'm lost ^^ I will take a bit of time to uderstand this PSR-18 |
Hmm... I have added |
1b5533c
to
469facc
Compare
@Zeichen32 can you please shed some light here? |
…/meilisearch-php into fix-locked-in-guzzle-depenedency
@emulienfou @curquiza Please review the PR. Welcome any suggestions |
Sorry for my late replay. Yes you can replace the Guzzle Client with any other implementation. I had choose the Guzzle Client in my PR to prevent breaking changes. In my own project i use the symfony http client without any problems. |
@ppshobi To use the Symfony HTTP Client, the documentations says it needs the nyholm/psr7 lib to provide a response and stream factory. So i thinks the docs for the symfony client should be: https://symfony.com/doc/current/http_client.html#psr-18-and-psr-17 |
@Zeichen32 the tests were passing with just Any idea why? |
Maybe you can give me a hint. In the test logs the composer is installing the guzzle http client, so the tests are green because it find the guzzle client. "But with only nyholm/psr7" You need to install the symfony http client AND the psr7 factories, because the symfony client is not PSR 18 compatible out of the box. |
@Zeichen32 In test logs it shows guzzle client because for the test suite we install guzzle-6 adapter via the require-dev section. But while testing with symfony-client I removed guzzle adapter and installed symfony-client. |
And yes, with only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @ppshobi!
I put the breaking tag since these changes are breaking for the users!
Merging!
No description provided.