简体   繁体   中英

Composer force install package ignore dependency versions

I'd like to install reliese/laravel ( https://github.com/reliese/laravel/ ) package into my Laravel 6+ project. reliese/laravel requires "illuminate/support": "~5.1", but my version is now 6+. I've looked thru the reliese/laravel package, and it should still work with 6+. How can I force composer to install this package? I've tried --ignore-platform-reqs and that did not work.

From the composer docs on require

  • --ignore-platform-reqs : ignore php , hhvm , lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these. See also the platform config option.

So the flag only ignores machine-specific requirements and not package version mismatch.

I would recommend forking the package on GitHub, manually change the version requirement like so

{
    "require": {
        "php": ">=5.6.4",
        "doctrine/dbal": "~2.5",
        "illuminate/support": "~6.0",
        "illuminate/database": "~6.0",
        "illuminate/contracts": "~6.0",
        "illuminate/filesystem": "~6.0",
        "illuminate/console": "~6.0"
    }
}

and instruct Composer to pull the package from the fork in your composer.json

"require": {
    "reliese/laravel": "master",
},
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/solidau/laravel"
    }
]

I hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM