Creating Symfony projects like a sir
I’m pretty sure many of you don’t like to download the latest version of Symfony Standard Distribution from symfony.com, install it, remove the AcmeDemoBundle from src directory and remove those stuff mentioning it every time you start a new project. I don’t like it either. Fortunately, I have a better way to do so.
hacfi from Freenode channel #symfony-dev suggested me a way to start new projects, the only thing I’ve done is to create a bash script to automatize it. So first thing you have to do is install composer:
$ curl -S http://getcomposer.org/installer | php
$ mv composer.phar /usr/bin/composer
This way you can reach composer from anywhere you want by typing “composer” to the shell – you don’t even have to type “php” or “phar”. Next thing you should do is put a record to your crontab so it would update itself regularly (or if you prefer, you can do manually when you want with “composer self-update”).
Here comes the real trick: create a nice function to your ~/.bashrc file:
The usage of this little script is:
$ create-symfony path version
For example you want to create a new Symfony 2.1.3 project called foo:
$ create-symfony foo 2.1.3
This command will create a directory foo containing a new Symfony 2.1.3 project, but without the Acme directory, every reference to it, the apple-touch-icon.png and the favicon.ico. Now you can work with it :)
UPDATE: the way I described leaves two unfinished routes in app/config/routing_dev.yml, which has to be removed manually (_demo and _demo_secure).
UPDATE 2: no need to manually remove _demo and _demo_secure path now.