Allow installation on Drupal 10 (do not require guzzle6-adapter)

Created on 29 August 2023, about 1 year ago
Updated 5 September 2023, about 1 year ago

Problem/Motivation

I'd like to test the current dev branch, but https://git.drupalcode.org/project/search_api_meilisearch/-/commit/b873a... makes me unable to install it.

It now declares a dependency on php-http/guzzle6-adapter:^2.0 which pulls in v2.0.2 as this is the only PHP 8.1 compatible version, which in turn is needed for Drupal ^10 (which search_api_meilisearch declares to be compatible with).

Composer now barks at me because of this:php-http/guzzle6-adapter[v2.0.2, ..., 2.x-dev] require guzzlehttp/guzzle ^6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but these were not loaded, likely because it conflicts with another require.
Which is not really helpful, but I dug deeper and found the following:

$ composer depends guzzlehttp/guzzle
drupal/core-recommended 10.1.2 requires guzzlehttp/guzzle (~7.7.0)
drush/drush             12.1.2 requires guzzlehttp/guzzle (^7.0)

Even drupal/core-recommended:10.0.0 already requires guzzlehttp/guzzle: ~7.5.0 so this cannot ever work out for Drupal 10. Guzzle 7 does not need the guzzle6-adapter equivalent, as according to https://github.com/php-http/guzzle6-adapter/releases/tag/v2.0.2, Guzzle 7 already integrates that.
Newer meilisearch/meilisearch-php packages also support that, as https://packagist.org/packages/meilisearch/meilisearch-php?#user-content... states that requiring guzzlehttp/guzzle is enough.
However, http-interop/http-factory-guzzle:^1.0 should be added as well as per the docs.

Steps to reproduce

Install drupal/core-recommended:^10.0
Try to composer require drupal/search_api_meilisearch:dev-1.0.x
Installation fails.

Proposed resolution

I don't think a single branch can solve compatibility for Drupal 9.5 and Drupal 10.x, as Drupal 9.5 needs guzzlehttp/guzzle: ~6.5.8 and we cannot use guzzle 7, but Drupal 10 needs it.
I am no composer specialist, but I don't think conditionals can be added to composer.json.

With Drupal 9.5 support running out in just 3 months I'd suggest to just drop Drupal 8 (which is EOL anyway) and Drupal 9 support altogether and remove the requirement for php-http/guzzle6-adapter:^2.0.

Or just remove the dependency and let users decide (just like before) which PSR-18 implementation they want.

Or, somewhat as a middle ground, only suggest php-http/guzzle6-adapter:^2.0 so people still on D9.5 (and/or even D8) have a pointer to what they need to install. That's even an improvement to the current stable 1.0.0 where people needed to require php-meilisearch and some PSR-18 implementation themselves.

http-interop/http-factory-guzzle:^1.0 should be added as well as per the docs.

As a side note, testing newer Meilisearch server versions also becomes a little harder, now that the old meilisearch-php version is a requirement as well, though I understand it has to be there sometime to make it pull in the correct dependencies.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇹Austria tgoeg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024