[Symfony 2] composer.json for a assumed-stable symfony 2 distribution

This small composer.json file is used in a project i am working on atm, feel free to use it at own risk. I will provide non-periodical updates and hopefully soon a full upgrade to symfony 2.1.x including doctrine orm 2.2.x.

I still did not get the point regarding dependency resolution, so i simply “composed” the composer file by writing down my own requirements (“i want only the hottest, newest stuff!!”, then tracked down the error messages, removing them by explicetly writing down the missing dependencies by using the latest “dev-*” versions. After that i tried to run the project, which actually did not work, but selective downgrade of some of the bundles (framework, security-extra blahblah) finally did the job.

Feel free to use it in your own projects:

{
"require" : {
"symfony/symfony" : "v2.0.12",
"doctrine/common" : "2.1.4",
"doctrine/orm" : "2.1.6",
"symfony/finder" : "v2.0.12",
"symfony/assetic-bundle" : "2.0-dev",
"twig/extensions" : "dev-master",
"jms/security-extra-bundle" : "1.1.0",
"sensio/framework-extra-bundle" : "2.0-dev",
"sensio/distribution-bundle" : "2.0-dev",
"sensio/generator-bundle" : "2.0-dev"
},
"autoload" : {
"psr-0" : {
"Acme" : "src/",
}
}
}

Create a file named “composer.json” in your project’s root directory, then paste the above code into it and save it.

Now run

$ curl -s http://getcomposer.org/installer | php

After that, download all dependencies by typing

$ php composer.phar install

The easiest way to create a full project including AcmeDemoBundle, AppKernel and the whole stuff is to download the symfony 2 standard distribution without vendors and calling the script from there. The only thing to do is to modify the path to autoload.php, which should point to vendor/.composer/autoload.php.

Now you are able to upgrade your project’s dependencies to the newest versions by simply modifying the composer.json file. Have fun!.

3 Replies to “[Symfony 2] composer.json for a assumed-stable symfony 2 distribution”

  1. Very nice idea. I liked that you said you would maintain it.

    What it lacks is that I miss the command that makes me build from one file the new app project. I searched inside sensio distribution bundle and all the likes. I wonder if there is any. Have you ever tried KnpRad distribution?

  2. Did i really say something like that? Must have been drunk … ;)

    Thanks for both suggestions, for sure a gist will be probably the best solution for holding the list up-to-date, but it will definitively stay a packagist/composer-template and will never evolve into a full-featured distribution as e.g. symfony standard or knprad (which looks indeed very interesting).

    These distros seem to rise and fall with it´s maintainers commitment (like any linux distribution), and i am not able to take the responsibility to perform such a labour-intensive task.

    But any distribution will probably work with some configuration in combination with a composer.json file, so you may want to pick one and let rely it on packagist, maintaining and tweaking it for your own needs.

Leave a Reply

Your email address will not be published. Required fields are marked *