Composer: required packages with differing levels of minimum-stability(Composer:具有不同最低稳定性级别的所需软件包)
问题描述
我有一个用于 laravel 安装的 composer 文件,其中包含以下 composer.json 文件:
I have a composer file for a laravel installation with the following composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
我正在尝试为哨兵添加捆绑包.在哨兵的网站上,它说我可以通过将以下内容添加到我的 composer.json 文件来安装它:
I'm trying to add in the bundle for sentry. On sentry's website it says I can install it by adding the following to my composer.json file:
{
"require": {
"cartalyst/sentry": "2.0.*"
},
"minimum-stability": "dev"
}
我尝试在当前 laravel 的末尾添加新的 json 对象,如下所示:
I tried adding the new json object at the end of the current laravel one like so:
...
},
{
"require": {
"cartalyst/sentry": "2.0.*"
},
"minimum-stability": "dev"
}
当我运行 composer update
命令加载新包时,我收到一条错误消息,指出添加的新对象不是有效的 json.
When I run the composer update
command to load the new package I get an error saying that the new object addition is not valid json.
如果我将 cartalyst/sentry
添加到现有的 require
对象中,它将找不到哨兵包,因为现有的要求具有 stable 的最小稳定性值
.
If I add the cartalyst/sentry
to the existing require
object it cannot find the sentry package because the existing requires have a minimum-stability value of stable
.
有没有办法在一个单独的 require 对象中指定哨兵包,该对象具有 dev
的最低稳定性设置?
Is there a way of specifying the sentry package in a separate require object that has the minimum-stability setting of dev
?
推荐答案
答案就是添加@dev
{
"require": {
"cartalyst/sentry": "2.0.*@dev"
},
}
您可以在此处阅读关于最低稳定性设置的更多信息.
另一种方法是将您的最低稳定性设置为 dev,但告诉作曲家您想尽可能使用稳定版:
An alternative is to set your minimum-stability to dev, but tell composer you want to use stable whenever possible:
"minimum-stability": "dev",
"prefer-stable" : true
这基本上意味着它将始终使用 stable 除非无法安装 stable 依赖项,因此使用 dev.
This basically means it will always use stable UNLESS there is no way to install a stable dependency, and therefore use dev.
这篇关于Composer:具有不同最低稳定性级别的所需软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Composer:具有不同最低稳定性级别的所需软件包
基础教程推荐
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01