在Composer中覆盖PHP基本依赖项 [英] Override PHP base dependency in composer

查看:114
本文介绍了在Composer中覆盖PHP基本依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在只有PHP 5.5.6的主机上安装Laravel 5.1.当我要求客户进行升级时,这可能/不可行.

I try to install Laravel 5.1 on a host which only has PHP 5.5.6. While I asked the customer to upgrade, this might be not possible/feasible.

所以我得到:

- This package requires php >=5.5.9 but your PHP version (5.5.6)
   does not satisfy that requirement.

composer.phar install上.

有没有办法做一个忽略这个依赖的作曲家安装?

Is there a way to do a composer install which ignores this dependency?

我认为应该是安全的,因为只有5.5.6至5.5.9的错误修复.

I think it should be safe, as there are only bug-fixes from 5.5.6 to 5.5.9.

推荐答案

错误消息指示来自主composer.json的要求.版本要求可以只是适配器:

The error message indicates a requirement from the main composer.json. The version requirement can be just adapter:

"require": {
    "php": ">=5.5",

像这样更改版本后,我得到:

After changing the version like this I get:

  Problem 1
    - Installation request for classpreloader/classpreloader 2.0.0 -> satisfiable by classpreloader/classpreloader[2.0.0].
    - classpreloader/classpreloader 2.0.0 requires php >=5.5.9 -> your PHP version (5.5.6) or "config.platform.php" value does not satisfy that requirement.
  Problem 2
    - Installation request for laravel/framework v5.1.17 -> satisfiable by laravel/framework[v5.1.17].
    - laravel/framework v5.1.17 requires php >=5.5.9 -> your PHP version (5.5.6) or "config.platform.php" value does not satisfy that requirement.
  Problem 3
    - Installation request for laravelcollective/html v5.1.6 -> satisfiable by laravelcollective/html[v5.1.6].
    - laravelcollective/html v5.1.6 requires php >=5.5.9 -> your PHP version (5.5.6) or "config.platform.php" value does not satisfy that requirement.
  Problem 4
    - laravel/framework v5.1.17 requires php >=5.5.9 -> your PHP version (5.5.6) or "config.platform.php" value does not satisfy that requirement.
    - jenssegers/agent v2.1.7 requires illuminate/support ~4.0|~5.0 -> satisfiable by laravel/framework[v5.1.17].
    - Installation request for jenssegers/agent v2.1.7 -> satisfiable by jenssegers/agent[v2.1.7].

composer.json中使用以下代码段,可以模拟php版本

Using the following snippet in composer.json, a php version can be simulated

[...]
"config": {
    "preferred-install": "dist",
    "platform": {
        "php": "5.5.9"
    }
}

文档: https://getcomposer.org/doc/06-config.md#平台

平台

让您伪造平台软件包(PHP和扩展),以便您可以模拟生产环境或在配置中定义目标平台.例如:{"php":"5.4","ext-something":"4.0"}.

Lets you fake platform packages (PHP and extensions) so that you can emulate a production env or define your target platform in the config. Example: {"php": "5.4", "ext-something": "4.0"}.

不要忘记在此之后运行composer.phar update

Don't forget to run a composer.phar update after this

这篇关于在Composer中覆盖PHP基本依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆