Using the master version of a composer package without modifying the minimum-stability flag

Published on 2020-01-11 • Modified on 2020-01-12

This is a super useful trick to test packages at arbitrary versions. In the following example, the master branch of the friendsofsymfony/elastica-bundle is used but is flagged as a specific tag. This allows us to test the master version before a tag is released without modifying the minimum-stability parameter. If you modify this flag to dev, Composer will require the master branch of ALL packages! And, with this setting, great chances that your application is broken (don't do this!).
[Edit 2020/01/12]: You can also use the "prefer-stable": true parameter to achieve the same result. In this case you can leave "dev-master" for the package version.


{
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "friendsofsymfony/elastica-bundle": "dev-master as 5.1.2"
    }
}

 More on Stackoverflow   Read the doc  Random snippet