I'm starting to use Symfony2 and following many tutorials. I found that when they installed some new features using composer.json
, they "always" declared dev-master
. I don't know the reasons why they always use it. An example from DoctrineFixturesBundle:
{ "require": { "doctrine/doctrine-fixtures-bundle": "dev-master" } }
Actually, I have googled and found some people written that If we use the dev-master
instead of any stable
version. It would be some conflicts in the future because the version today maybe 1.5.0
and tomorrow maybe 1.6.0
.
So, what we really use in practical works - dev-master
or specified version
and why?
The dev-master branch is one in your main VCS repo. It is rather common that someone will want the latest master dev version. Thus, Composer allows you to alias your dev-master branch to a 1.0.x-dev version.
The package will not be installed unless those requirements can be met. require-dev (root-only) Lists packages required for developing this package (1), or running tests, etc. The dev requirements of the root package only will be installed if install is run with --dev or if update is run without --no-dev .
Classmap# The classmap references are all combined, during install/update, into a single key => value array which may be found in the generated file vendor/composer/autoload_classmap. php . This map is built by scanning for classes in all .
The require key# The first thing you specify in composer. json is the require key. You are telling Composer which packages your project depends on. { "require": { "monolog/monolog": "2.0.*" } } As you can see, require takes an object that maps package names (e.g. monolog/monolog ) to version constraints (e.g. 1.0.
It is rather common that someone will want the latest master dev version. Thus, Composer allows you to alias your dev-master branch to a 1.0.x-dev version. It is done by specifying a branch-alias field under extra in composer.json: If you alias a non-comparable version (such as dev-develop) dev- must prefix the branch name.
The dev-master branch is one in your main VCS repo. It is rather common that someone will want the latest master dev version. Thus, Composer allows you to alias your dev-master branch to a 1.0.x-dev version. It is done by specifying a branch-alias field under extra in composer.json:
composer: A Composer repository is a packages.json file served via the network (HTTP, FTP, SSH), that contains a list of composer.json objects with additional dist and/or source information. The packages.json file is loaded using a PHP stream.
In summary: check your composer.json files for "dev-master" entries and replace them with an appropriate expression which includes your current version (see https://getcomposer.org/doc/articles/versions.md ). This means that you won't get unexpected updates that might be breaking changes, but you can safely upgrade within your specified versions.
You should use a specific ( tagged stable at best ) version wherever possible.
While composer.lock
does lock the dependency to a specific commit even when using dev-master
... every composer update
will update the dependency to the latest version and afterwards update the lockfile.
If your lockfile somehow gets deleted/lost and it is not backuped / under version control you can easily end up with a non-working project after running composer install
or composer update
!
A simple example would be symfony/symfony
itself ... new commits might introduce new BC (backward compatibility) breaks in the dev-master
branch any time leaving your application in a non-functional state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With