How to always use ignore-platform-reqs flag when running composer?(运行composer时如何始终使用ignore-platform-reqs标志?)
问题描述
在我的本地机器上,我有 php v7.0.3.我的一个项目依赖php v5.5.
On my local machine, I have php v7.0.3. A project of mine has a dependency on php v5.5.
正如预期的那样,一个简单的 composer install
运行崩溃了:
So as expected, a simple run of composer install
crashes:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ~5.5 but your PHP version (7.0.3) does not satisfy that requirement.
我知道我可以通过以下方式忽略该平台:
I know I can ignore the platform via:
composer install --ignore-platform-reqs
但我经常忘记添加标志.然而,由于应用程序在 docker 容器内运行,不匹配的 php 可以同样好地安装依赖项.
yet I often forget to add the flag. Yet since the application runs inside a docker container, a mismatching php can install the dependencies just as fine.
所以我想知道是否有办法让我的本地作曲家总是假设 --ignore-platform-reqs
以便不必输入它.
So I am wondering if there is a way to make my local composer always assume --ignore-platform-reqs
in order to not having to type it.
我喜欢避免设置别名并让它在作曲家配置级别工作.
I like to avoid setting an alias and have it work on composer config level.
推荐答案
推荐 fakephp 版本,而不是忽略平台要求.添加
It's recommended to fake php version, rather than ignore platform requirements. Add
"platform":{"php":"5.5"}
到你的 ~/.composer/config.json
或使用 composer config -g -e
来编辑它.
to your ~/.composer/config.json
or use composer config -g -e
to edit it.
一个足以伪造 php 版本的配置示例:
An example of sufficient config to fake php version:
{
"config": {
"platform":{
"php":"5.5"
}
}
}
不过它可能有更多选择.
It may have much more options though.
这篇关于运行composer时如何始终使用ignore-platform-reqs标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:运行composer时如何始终使用ignore-platform-reqs标志?
基础教程推荐
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- HTTP 与 FTP 上传 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01