跳过作曲家 PHP 要求 [英] Skip composer PHP requirement

查看:28
本文介绍了跳过作曲家 PHP 要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 PHPCI 和 composer.运行 PHPCI 的服务器是 PHP 5.3.

We are using PHPCI and composer. The server which runs PHPCI is on PHP 5.3.

对于一个项目,我们使用 composer 添加了 Facebook PHP SDK.它需要 PHP 5.4.Composer 被 PHPCI 触发并被执行.但是因为 CI 服务器刚刚获得 PHP 5.3 composer 失败并显示错误消息:

For a project we added the Facebook PHP SDK, using composer. It requires PHP 5.4. Composer gets triggered by PHPCI and get executed. But because the CI server just got PHP 5.3 composer failed with the error message:

facebook/php-sdk-v4 4.0.9 requires php >=5.4.0 -> no matching package found.

这当然会让我在 PHPCI 中的构建失败.

This let fail my build in PHPCI, of course.

是否有可能跳过此要求?也许通过向 composer.json 添加一个选项?还是 composer.phar 调用的参数?

Is there a possibility to skip this requirement? Maybe by adding an option to composer.json? Or a parameter to composer.phar call?

推荐答案

我找到了选项:

composer install --ignore-platform-reqs

忽略平台要求(php & ext-packages).

Ignore platform requirements (php & ext- packages).

你可以跳过平台检查,但 Composer 将根据给定的 PHP 版本获取包.因此,当您需要 composer 在依赖解析期间模拟 PHP 版本时,您可以(并且应该!)在您的 composer.json 中使用它:

You can skip the platform checks with this, but Composer will fetch packages based on given PHP version then. So when you need composer to also emulate a PHP version during depedency resolving, you can (and should!) use this in your composer.json:

{
    "config": {
       "platform": {
           "php": "5.6.6"
       }
    }
}

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

这篇关于跳过作曲家 PHP 要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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