
In Drupal 8.8 though 9.0, Drupal Composer project templates declared their minimum stability as follows:
"minimum-stability": "dev",
"prefer-stable": true,
This allowed any development version to be installed with the template; however, it occasionally produced unexpected results, such as upgrading to newer unstable releases rather than remaining on a current stable release. The Composer "prefer stable" setting is considered to be advisory only, and does not guarantee that a stable release will be chosen even when one is available.
Therefore, as of Drupal 9.1.0-alpha1, Drupal Composer project templates declare minimum stability matching the stability of the Drupal version.
- Drupal 9.1.0-alpha1 will set minimum stability to "alpha"
- Drupal 9.1.0-beta1 will set minimum stability to "beta"
- Drupal 9.1.0-rc1 will set minimum stability to "RC"
- Drupal 9.1.0 will set minimum stability to "stable"
Note that changes to the template files does not affect existing sites that are already managed by Composer. Users with such sites will have to manually adjust their minimum stability setting if they would like to follow Drupal core's example. The template projects are used to generate the Drupal tarball archives, so new sites created or existing sites updated from an archive will adopt the new minimum stability, which will be respected if the site is converted to Composer-managed.
When using a site with minimum stability stable, it is still possible to include non-stable dependencies by explicitly requiring the desired version in the top-level composer.json file using stability flags. For example:
$ composer require drupal/contrib:^1.0@beta
This would allow the beta or higher stabilities of the contrib project to be included; however, if the module had a dependency of its own that was not yet stable, the above command would fail due to the second-level dependency not meeting the minimum stability requirements. This situation can be resolved in a similar way, by requiring both the unstable contrib project and the unstable dependency:
$ composer require drupal/contrib:^1.0-beta1 outside/library:@alpha
If all needed unstable dependencies are listed in this manner, then they may be included in the project regardless of its minimum stability setting.
Note that the above example uses a bare stability flag for the outside/library
dependency in order to eliminate the need to maintain the version numbers that drupal/contrib
relies upon.
For more details in the composer documentation, refer to https://getcomposer.org/doc/04-schema.md#package-links