A quick Symfony base installation.
First day of our Build CMS Application with Symfony articles suite.
- base knowledge of Symfony 2 (see the doc),
- composer installed globally (see Composer doc),
- a virtual host setup (see Setup a virtual host on Ubuntu),
- if you want to do some clever git version : gitflow on Github installed
Let’s go for the base install
Verify the last version of Symfony on the Download page
Create a tuto.dev virtual hosts
During this install you will be prompted for some settings (database, etc …). You can validate all the default, we’ll take care of this later.
Setting files permissions
I use this code to set permissions on my dev box. Other ways can be found in Symfony install doc.
You can now point to http://tuto.dev/config.php/ to check our configuration. Then make appropriates change to your /etc/php5/apache2/php.ini file.
Note : On ubuntu 12.04 xdebug config is done in /etc/php5/apache2/conf.d/20-xdebug.ini.
You also have to make the check on CLI side as the php.ini file used is different.
Then make appropriates change to your /etc/php5/cli/php.ini file.
If you want to upgrade your php to a newest version you can read my Install PHP 5-5-4 on Ubuntu 12-04.
and your done. Nearly.
You can already see your page at http://tuto.dev/app_dev.php.
Some more setup
Database, mail and various parameters
For performance reasons during tests, we want to use Sqlite database. This will allow us to use in memory db and to copy paste a fresh db between each test suite.
Setup is the following :
You also need to uncomment the path line in app/config/config.yml and to add the memory line.
Create the database.
Finally uncomment translator line :
Two little things about composer and composer update :
- Composer makes a hard copy of your assets (css, js, img) in the web/ folder. When you work on Linux you can just make symlinks. So we will add a “symfony-assets-install”: “symlink” directive in composer.json.
- Composer verifies that your parameters are conform to config.yml.dist template. So it deletes path and memory lines in our parameter.yml. We will add a “keep-outdated”: true incenteev-parameters line in composer.json in order to keep our sqlite settings (path and memory). If you don’t do this, doctrine.dbal.path and doctrine.dbal.memory are deleted from your parameter.yml file each time you do a composer update.
Add two lines in composer.json
Version the code
Yes we are supposed to work with versioning even when working alone. I personally work with git-flow.
Et voilà ! Next step will be to install Behavior Driven Development tools