日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

Setting composer minimum stability for your application

發(fā)布時間:2024/10/12 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Setting composer minimum stability for your application 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Do you have a confusion of how do you determine the stability when using composer dependency manager? What should be the?minimum stability?setting? Do you receive this dreaded error when updating via composer?

?

1 2 Your requirements could not be resolved to an installable set of packages.

?

Well all of them probably point to the right stability setting in your composer settings. Read on to understand how you can set your application landscape and package dependencies the right way.

Minimum Stability Settings

Composer accepts these flags as?minimum-stability?settings. The default setting for?minimum-stability?if not provided is assumed to be?stable, but you could define any of the flags down the hierarchy.

-stable?(most stable)
–?RC
–?beta
–?alpha
–?dev?(least stable)

Resolving Stability Dependencies

So let’s consider you have set a?minimum-stability?to?stable?in your composer.json, and on updating packages, receive an error like below:

?

1 2 3 4 Your requirements could not be resolved to an installable set of packages. - vendor/package1 dev-master requires vendor/package2 * -> satisfiable by vendor/package2[dev-master]. - vendor/package3 dev-master requires vendor/package4 * -> satisfiable by vendor/package4[dev-master].

?

The reason for this is that all of your packages need a?minimum-stability?of?stable. This may not be available for all your dependent packages. You do need a lower stability setting for them. So how do you resolve this? Here are the various options that you could consider to resolve the package dependencies.

Option 1: Set minimum-stability to dev

You can lower your minimum-stability down to “dev”. But when you do that, it applies to all constraints and as a result you may get unstable versions of all packages which you do not desire. Let’s consider an example of installing the?yiisoft/yii2?framework. You would want a stable release of yii2 to be applied each time you run composer. But setting?minimum-stability?to?stable?do affect your install/update of other yii2 extensions like?kartik-v/yii2-widgets,?kartik-v/yii2-grid?etc. But the recommendation still is DO NOT change theminimum-stability?UNTIL you really need to. If you are working with?minimum-stability?set tostable, then move on to?Option 2.

Option 2: Use stability flags (recommended)

Rather than changing?minimum-stability?setting, use?stability flags. As described in?this article?– a stability flag is defined as part of a version constraint. Since stability is determined by the root package only, flags are also root-only. Flags defined in dependent packages are simply ignored. You can use flags to whitelist specific unstable packages. So let’s see your stability section of the revised composer.json now for?yiisoft/yii2?with?kartik-vextensions. If you are installing say?kartik-v/yii2-grid?extension with?yiisoft\yii2. First check composer.json for?yii2-grid?and then its require section. The package?yii2-gridrequires these packages:

?

1 2 3 4 5 6 7 8 ????"require": { ????????"kartik-v/yii2-widgets": "*", ????????"kartik-v/yii2-editable": "*", ????????"kartik-v/yii2-slider": "*", ????????"kartik-v/yii2-money": "*", ????????"kartik-v/yii2-checkbox-x": "*" ????},

?

Now in your application composer.json, set?yii2-grid?and its dependent packages to?@devas shown below

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 ????"minimum-stability": "stable", ????"require": { ????????"php": ">=5.4.0", ????????"yiisoft/yii2": "*", ????????"yiisoft/yii2-bootstrap": "*", ????????"yiisoft/yii2-swiftmailer": "*", ????????"kartik-v/yii2-grid": "@dev", ????????"kartik-v/yii2-widgets": "@dev", ????????"kartik-v/yii2-editable": "@dev", ????????"kartik-v/yii2-slider": "@dev", ????????"kartik-v/yii2-money": "@dev", ????????"kartik-v/yii2-checkbox-x": "@dev" ????},

?

You can note that you did not define an actual version in the root package. Now with this, your?yiisoft/yii2?install does not care about the stability of?kartik-v/yii2-grid?and its required extensions/packages for example.

Option 3: Set?prefer-stable?option

Another option could be to set the prefer-stable option for your packages. This can be easy to use and can often work for you. For example, you can add the following line in your root composer.json:

?

1 2 3 minimum-stability: dev, prefer-stable: true

?

Composer will automatically then try to figure out the most stable dependencies it can. If you require a dev version or only alphas are available for a package, those will still be selected granted that the?minimum-stability?allows for it.

Having said that, you may still want to set what stability you really want, and declaring it explicitly. Otherwise, you would not know which version of the package caused what problem. So as a general thumb rule then,?option 2?may yet be the best way to go forward in handling minimum stability.

?

link:http://webtips.krajee.com/setting-composer-minimum-stability-application/

轉(zhuǎn)載于:https://www.cnblogs.com/walter371/p/4066606.html

總結(jié)

以上是生活随笔為你收集整理的Setting composer minimum stability for your application的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。