首页 > 解决方案 > Composer 强制安装包忽略依赖版本

问题描述

我想将reliese/laravelhttps://github.com/reliese/laravel/)包安装到我的 Laravel 6+ 项目中。reliese/laravel需要"illuminate/support": "~5.1",,但我的版本现在是 6+。我已经查看了这个reliese/laravel包,它应该仍然适用于 6+。如何强制作曲家安装这个包?我试过--ignore-platform-reqs了,但没有奏效。

标签: phplaravelcomposer-php

解决方案


作曲家文档开始require

  • --ignore-platform-reqs:忽略php、和要求并强制安装hhvm,即使本地机器不满足这些要求。另请参阅平台配置选项。lib-*ext-*

因此该标志只忽略特定于机器的要求,而不是包版本不匹配。

我建议在 GitHub 上分叉包,像这样手动更改版本要求

{
    "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"
    }
}

并指示 Composer 从你的 fork 中拉出包composer.json

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

推荐阅读