ongr-io / ElasticsearchDSL

Query DSL library for Elasticsearch
MIT License
460 stars 199 forks source link

Compatibility issue with Laravel 10 and symfony/mime in ongr/elasticsearch-dsl v7.2.2 #371

Open sreenikhilk opened 8 months ago

sreenikhilk commented 8 months ago

Hi,

I'm encountering a version conflict issue while trying to use ongr/elasticsearch-dsl v7.2.2 with Laravel 10 and PHP 8.2.8.

Symptoms:

When running composer require ongr/elasticsearch-dsl, I receive errors about conflicting dependencies:

Is there a known compatibility issue between ongr/elasticsearch-dsl v7.2.2, Laravel 10, and symfony/mime ^6.2?

Are there recommended workarounds or alternative versions to address this conflict? Is there a roadmap for updating ongr/elasticsearch-dsl's dependencies to resolve this compatibility issue? Additional Information:

Laravel version: 10 (latest) PHP version: 8.2.8 Composer output:

composer require "ongr/elasticsearch-dsl 7.2.2"           
./composer.json has been updated
Running composer update ongr/elasticsearch-dsl
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/serializer[v5.0.0, ..., v5.0.8] require php ^7.2.5 -> your php version (8.2.8) does not satisfy that requirement.
    - symfony/serializer[v5.3.0, ..., v5.3.14] require symfony/deprecation-contracts ^2.1 -> found symfony/deprecation-contracts[v2.1.0, ..., v2.5.2] but the package is fixed to v3.4.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - laravel/framework is locked to version v10.40.0 and an update of this package was not requested.
    - ongr/elasticsearch-dsl v7.2.2 requires symfony/serializer ^5.0 -> satisfiable by symfony/serializer[v5.0.0, ..., v5.4.34].
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.4.34.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.4.25.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.4.21.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.4.2.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.4.0.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.2.12.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.2.11.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.2.1.
    - symfony/mime v6.4.0 conflicts with symfony/serializer v5.0.11.
    - laravel/framework v10.40.0 requires symfony/mime ^6.2 -> satisfiable by symfony/mime[v6.4.0].
    - Root composer.json requires ongr/elasticsearch-dsl 7.2.2 -> satisfiable by ongr/elasticsearch-dsl[v7.2.2].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.1",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^10.0",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/pint": "^1.0",
        "laravel/sail": "^1.18",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^7.0",
        "phpunit/phpunit": "^10.0",
        "spatie/laravel-ignition": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "branch-alias": {
            "dev-master": "10.x-dev"
        },
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "allow-plugins": {
            "pestphp/pest-plugin": true
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true
}
sreenikhilk commented 8 months ago

This pull request PR caught my eye as a potential solution to this problem. It's still under review, though.

Edit - https://github.com/ongr-io/ElasticsearchDSL/issues/368

For those who are stumbled upon the Laravel 10 and ongr-elasticsearch dependency hell, two possible alternatives of this packages are (forked):

https://github.com/bistrosk/elasticsearch-dsl. https://github.com/handcraftedinthealps/ElasticsearchDSL