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标志?


基础教程推荐
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01