Setting up a bleeding edge Symfony2 project

Warning: This blog post was written a long time ago and might be no longer relevant.

Symfony2 is not ready yet. Since the release is planned for March this year and I just can't wait any longer I started to play with it more seriously.

I also want to know all those nitty-gritty details. Therefore I didn't go for sandbox and decided to generate a fresh project.

Warning: symfony-bootstrapper described in this article is deprecated and not mainained anymore.

There are already several articles describing the process using the symfony-bootstrapper:

Symfony2 internals are being changed every day. For someone who wants to be always up to date I think it's better to utilize git submodules for vendor libraries. Here is slightly modified process of generating your own Symfony2 project.

Let's start with getting the Symfony2 bootstrapper:

    git clone git:// ~/workspace/lib/Symfony2-bootstrapper

We'll need a project directory and a git repository as well:

mkdir ~/workspace/projects/FooBar
cd ~/workspace/projects/FooBar
git init .

Finally we can initialize a Symfony2 project so the basic directory structure is in place:

cd ~/workspace/projects/FooBar
php ~/workspace/lib/Symfony2-bootstrapper/symfony.phar init --name 'FooBar' --format="yml"
git add app/ src/ web/
git commit -m 'Bootstrapped Symfony2 application.'

Last but not least we'll install Symfony2 and other vendor libraries as a git submodules:

cd ~/workspace/projects/FooBar
git submodule add git:// src/vendor/symfony
cat src/vendor/symfony/ | grep "git clone" | awk '{print "git submodule add "$3" src/vendor/"$4}' | while read line; do $line; done
git commit -m 'Added vendor submodules.'

Note: At the moment of writing this there's a small bug in the bootstrapper. Recently the UniversalClassLoader was moved to its own component and it's not yet changed in the bootstrapper (both in the source code and the phar archive). I committed a fix but my pull request is not yet merged. By the time it happens you can simply modify a path in the src/autoload.php of generated project (replace HttpFoundation with ClassLoader in a path to UniversalClassLoader.php).