Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Update meilisearch-php to v0.14 #47

Merged
merged 5 commits into from
Sep 23, 2020
Merged

Update meilisearch-php to v0.14 #47

merged 5 commits into from
Sep 23, 2020

Conversation

bensherred
Copy link
Contributor

@bensherred bensherred commented Sep 21, 2020

Updated the meilisearch-php dependency to v0.14.0. This fixes any locked dependency issues with guzzle 6 to allow any psr18 compatible HTTP client to be used instead.

This will fix #43.

As Laravel comes with Guzzle out the box, we do not need to require the additional installation of the following dependencies php-http/guzzle6-adapter:^2.0

@curquiza curquiza requested a review from shokme September 22, 2020 08:13
@shokme
Copy link
Collaborator

shokme commented Sep 22, 2020

Hello @bensherred

You still need: http-interop/http-factory-guzzle else the http/discovery will not be able to found the factory.
No PSR-17 request factory found

.gitignore Outdated Show resolved Hide resolved
@bensherred
Copy link
Contributor Author

Ah that makes sense, I've gone ahead and added that. Thanks for your help @shokme.

@curquiza curquiza requested a review from shokme September 22, 2020 09:49
curquiza
curquiza previously approved these changes Sep 22, 2020
@shokme
Copy link
Collaborator

shokme commented Sep 22, 2020

There is a problem, you need to instantiate Guzzle inside the MeilisearchServiceProvider that break all laravel version that are not using Guzzle 7.

But I found a potential solution I have to discuss with ppshobi about it. see you in meilisearch/meilisearch-php#76

@curquiza curquiza self-requested a review September 22, 2020 12:02
@curquiza curquiza dismissed their stale review September 22, 2020 12:03

need clarification before approval

@curquiza
Copy link
Member

Has laravel framework its own HTTP client that we can provide?
Shouldn't we add guzzle 6 as a dependency in this package?

@bensherred
Copy link
Contributor Author

@curquiza Laravel has a HTTP Client but it's just a wrapper for Guzzle. We can't require guzzle 6 either as Laravel 8 now uses Guzzle 7 instead.

@bensherred
Copy link
Contributor Author

Following the updates to meilisearch/meilisearch-php, did we want to try using the alpha here as well? Currently we can't use the scout driver with Laravel 8 so might be helpful to try that.

@curquiza
Copy link
Member

Hum, not really good to have an alpha version in our codebase. Plus if everything is good during testing, I will create the official v0.14.1 this afternoon after my lunch (Paris local time 😅). All should be fixed at the end of this day (Paris local time again sorry) maximum.

@bensherred
Copy link
Contributor Author

Ah, that makes sense, I wasn't sure what your plans were on an official release. No point updating supporting alpha if it will likely be released this afternoon.

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and remarks! 🙂

README.md Outdated Show resolved Hide resolved
@@ -24,7 +24,8 @@
"require": {
"php": "^7.2.5",
"laravel/scout": "^8.0",
"meilisearch/meilisearch-php": "^0.13"
"meilisearch/meilisearch-php": "^0.14",
"http-interop/http-factory-guzzle": "^1.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't http-interop/http-factory-guzzle installed by default in Laravel 8 as Guzzle 7 is? 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Laravel comes with http-interop/http-factory-guzzle installed, here's the composer.json. I've had a look through those dependencies as well and doesn't look like any require them.

Copy link
Contributor Author

@bensherred bensherred Sep 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth removing still though as it's only required for Guzzle 6 and 7. I could add a note in the README about it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the factory is not installed by default.
This is only here to exploit PSR-17 (the php sdk discover the factory and use it for thing like $this->requestFactory->createRequest(...).

I don't know if we should remove it, a part of me is yeah we should because we don't want to "tie" the package with guzzle but in other hand as laravel pre-install guzzle since the version 7 why should we not simplify user life by pre-installing the factory, it will be good for most of laravel users.

For me both are ok, but I prefer option 2 😛

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keeping it (option 2). If someone is struggling with this decision, we will see!

A list of compatible HTTP clients and client adapters can be found at [php-http.org](http://docs.php-http.org/en/latest/clients.html).

If you use **Laravel 8** you can skip this section as laravel pre-install Guzzle 7 by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a line for Guzzle 7:

$ composer require guzzlehttp/guzzle

For users using Laravel < 8 but who want to use guzzle 7

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to you ?

@curquiza
Copy link
Member

Thanks again for this PR @bensherred!
Could you rebase your branch, please? 🙂

@curquiza curquiza changed the title Update meilisearch-php to v0.14 Update meilisearch-php to v0.14.1 Sep 23, 2020
@curquiza curquiza changed the title Update meilisearch-php to v0.14.1 Update meilisearch-php to v0.14 Sep 23, 2020
@bensherred
Copy link
Contributor Author

Not sure if I am doing something wrong with the rebase @curquiza?
Screenshot 2020-09-23 at 15 36 07

@curquiza
Copy link
Member

curquiza commented Sep 23, 2020

@bensherred, it looks like you did not do the first step Add the main repository as a remote of the gist, see the error: 'upstream' does not appear to be a git repository.

I don't know if you join to our Slack, but if you want direct chatting for the rebase, join us (I'm Clementine).

@curquiza
Copy link
Member

If you think all is ready @shokme, you can merge when you want! 🙂

@shokme shokme merged commit f0115b8 into meilisearch:master Sep 23, 2020
@bensherred bensherred deleted the update-meilisearch-php branch October 23, 2020 11:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

install error with laravel 7
3 participants