Override PHP base dependency in 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 安装
.
有没有办法让作曲家安装忽略这种依赖关系?
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 adapted:
"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 更新
Don't forget to run a composer.phar update
after this
这篇关于在作曲家中覆盖 PHP 基本依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在作曲家中覆盖 PHP 基本依赖项
基础教程推荐
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01