【问题标题】:composer require specific version作曲家需要特定版本
【发布时间】:2018-04-18 10:50:30
【问题描述】:

我需要在 php 5.6 的环境中使用 jenssegers/blade 包,所以我需要使用Illuminate 5.1(正是这个版本)。在 vendor/jensegers/blade/composer.json 它需要

"require": {
    "illuminate/view": "^5.1"
},

执行 composer update 它会下载需要 php 7+ 的最新版Illuminate (5.6.17)。

Laravel 5.1 与 php >= 5.5.9 一起工作,并且应该与Illumina 5.1 相同。

我想强制下载Illuminate 5.1,所以我删除了vendors/lluminate目录并编辑了vendors/jenssegers/blade/composer.json,删除了版本之前的'^':

"require": {
    "illuminate/view": "5.1"
}

但是作曲家更新一直在下载:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
- Installing illuminate/contracts (v5.6.17): Loading from cache
- Installing illuminate/support (v5.6.17): Loading from cache
- Installing illuminate/filesystem (v5.6.17): Loading from cache
- Installing illuminate/container (v5.6.17): Loading from cache
- Installing illuminate/events (v5.6.17): Loading from cache
- Installing illuminate/view (v5.6.17): Loading from cache

【问题讨论】:

  • 使用 composer install 代替?
  • 尝试:将vendor/laravel/framework/composer.json"illuminate/view": "self.version"编辑为"illuminate/view": "^5.1"
  • 使用 composer install 我得到 5.6.17(如 composer update)。我没有供应商/laravel。我正在使用 jessengers/blade 因为我只需要没有 laravel 的刀片。
  • @SandOfVega 从不编辑 vendor 中的内容。从不。
  • 我知道@NicoHaase。但是在这种情况下没有其他办法。 :|

标签: php laravel laravel-5 composer-php


【解决方案1】:

如果您需要安装 PHP 5.6,您应该将其添加到您的 composer.json:

"config": {
    "platform": {
        "php": "5.6"
    }
}, 

https://getcomposer.org/doc/06-config.md#platform

如果你需要锁定到指定版本的包,你也可以给你的composer.json添加约束,但是配置PHP版本通常是一个更好的主意。

"require": {
    "illuminate/view": "5.1.*"
},

【讨论】:

  • 旁注:没有给定包的 v5.1
  • @NicoHaase 有一个 5.1.41 可以安装此约束。
  • 但是约束“5.1”不应该安装“5.1.41”,这就是为什么你需要v 5.1
猜你喜欢
  • 1970-01-01
  • 2015-07-11
  • 2019-08-13
  • 2021-03-03
  • 2012-05-01
  • 1970-01-01
  • 2016-03-29
  • 2018-05-31
  • 1970-01-01
相关资源
最近更新 更多