Video: Symfony2 on fortrabbit

Frank Lämmer
grown up graffiti kid

This is the fifth video of our screen-cast series where we are showing off our worst practices of PHP development & deployment on our sophisticated hosting platform. This is our inofficial contribution to the Symfony Live Event 2012 here in Berlin.

Learn here about one way (out of many) to install the famous Symfony2 (a popular PHP framework to build web projects. Also the base for some CMS systems, like the new Drupal8) on the fabulous fortrabbit PHP hosting platform. See the ultra cool text editor Sublime Text 2, the fortrabbit web GUI, gorgeous Git version and PHP Composer in action.

This how-to is targeted to developers adept with the shell.

Please enlarge the video and switch to HD to get the details. This video was written, directed and produced by our chief engineer Ulrich Kautz.

Step by Step

As always: To reproduce all steps, we assume you have an existing App on fortrabbit with your SSH setup for Git access. Our demo App is called “app-demo” – replace this with your App’s name.

  1. Use the shell to download and install PHP composer locally
  2. Use the shell to install Symfony2 via PHP composer to a local folder
  3. Composer is doing all the dirty work (FFWD)
  4. Init Git and add the fortrabbit remote branch
  5. Push to fortrabbit and trigger the remote composer with a special comment in the commit message
  6. The fortrabbit platform is doing all the dirty work (FFWD):
    1. Syncing the remote repo into the web-space
    2. Running composer on the remote server to install all dependencies
  7. Create a Symfony2 bundle (where? what? why?)
  8. Set the doc root path in the fortrabbit control panel to match best Symfony2 conventions
  9. Grab the .htaccess example rules from the fortrabbit help and paste them in the project (WHY?)
  10. Push to deploy all changes to the fortrabbit web servers
  11. See the results in the browser

Terminal Transcript

$ cd projects/
$ curl -s | php
$ php composer.phar create-project symfony/framework-standard-edition AppDemo 2.1.2
$ cd AppDemo
$ git init .
$ git remote add origin
$ git add -Av
$ git commit -am 'Initial [trigger:composer]'
$ git push origin master
$ php app/console generate:bundle

# modify AppDemo/web/.htaccess -> add the following after "Rewrite Engine On"
RewriteCond %{REQUEST_URI} \.php/ [NC]
RewriteRule ^(.*)\.php/(.*)$    /$1.php [NC,L,QSA,E=PATH_INFO:"/$2"]

$ git add -AV
$ git commit -am 'Bundle & .htaccess'
$ git push origin master

Further Readings

The other videos

  • Rik van der Kemp

    Please note, you will have to enable the composer hook in your app management panel for this tutorial to work properly.

    Go to your app dashboard, click on the tab ‘Git’ and find the button ‘Configure hooks’ under the ‘Git hooks’ heading. :-)

  • Dim Dask

    I was trying to follow this guide, but neither curl nor php are available in the SSH shell. I tried ftping a whole tar with symfony included, but while untaring, I got the Disk quota exceeded messages. So how can I install symfony framework and then my demo app?


  • ulrich-kautz

    Hey Dim

    Sorry for the late reply.

    @Download: You can use wget when logged in with your SSH account.
    @Install: Use the /tmp folder for downloading and unzipping. You have here an additional quota of 1GB temp storage.

    Hope this helped,