Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When "dev-master" should be used in composer.json?

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?

like image 902
lvarayut Avatar asked Sep 25 '13 15:09

lvarayut


People also ask

What is Dev master in composer?

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.

What is require Dev in composer?

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 .

What is Classmap in composer json?

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 .

What is require in composer json?

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.

How to alias The Master Dev version in composer?

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.

What is the Dev-Master branch in composer?

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:

What is composer repository in composer?

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.

How to update composer to the latest version?

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.


1 Answers

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.

like image 188
Nicolai Fröhlich Avatar answered Oct 23 '22 06:10

Nicolai Fröhlich