Install Symfony 1.4 under Git

I’ve met in the Internet nice article about Howto Create Symfony 1.4 project with Git and cut out stuff related to Symfony and Git only.
1. Clone the symfony-1.4 svn repository.

[php]$ git svn clone  lib/vendor/symfony-1.4[/php]

When a 1.4 update comes along, go to the lib/vendor/symfony-1.4 directory and
execute the following command to update your copy.

[php]$ git svn rebase[/php]

2. Now take care of the svn externals by first retrieving a script that extends git’s power
(based on a work by Andre Pang) and running git-svn-update-externals inside the
framework directory lib/vendor/symfony-1.4.

$ git clone git://  lib/vendor/git-sue
$ cd lib/vendor/symfony-1.4
$ ../git-sue/git-svn-update-externals

3. Assuming you are back on your project root directory, verify your Symfony installation.

[php]$ lib/vendor/symfony-1.4/data/bin/symfony -V[/php]

If Symfony has been installed correctly, the version should be displayed.
If you got something like
[php]PHP Fatal error:  require(): Failed opening required ‘/home/alex/projects/php-projects/sfprojects/project/lib/vendor/symfony/lib/event_dispatcher/sfEventDispatcher.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /home/alex/projects/php-projects/sfprojects/project/lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php on line 99
This means that you didn’t find ‘event_dispatcher’ item that is external item. Please run

[php]$ ../git-sue/git-svn-update-externals[/php]

to fix that.
4. Initialize your Symfony project.

[php]$ lib/vendor/symfony-1.4/data/bin/symfony generate:project {project_name}[/php]

Note that Symfony also creates a symfony script at your project root directory. You can
use that instead of referring back to lib/vendor/…, which can be really repetitive.
5. Modify ./symfony to add directory tracking support for git. Before the chdir() call in
symfony, add the following line:

[php]register_shutdown_function(create_function(”, ‘touch("cache/.ignore");

6. Initialize a project application. Repeat for other applications if project consists of more
than one application. You can skip this step if your project is still on the drawing board,
but pay attention to step 9.

[php]$ ./symfony generate:app {app_name}[/php]

7. Configure git scm on project root and add user information. Signing key and remote
repository are optional (team/public project), although they are recommended for
obvious reasons.

$ git init
$ git config {real_name}
$ git config {email_address}
$ # git config user.signingkey {gpg_key}
$ # git remote add origin {repo_url}

8. Add git exclude information to .git/info/exclude. Files to be excluded are normally editing
backup copies and vendor files (which are already gitted). Special care is also needed
for cache and log directory because git don’t track empty directory but can introduce
symfony errors later on.


You can create the .ignore files now, especially if you skipped step 7.

[php]$ touch cache/.ignore log/.ignore[/php]

9. Perform your initial commit. Optionally, you can also pushed your newly initialized
repository to the remote repo if you’ll be working with a team or just making it available

$ git add .
$ git commit -a -m ‘Initial commit.’
$ # git push origin master

10. Configure your httpd configuration with virtual hosting as appropriate, and don’t forgot to
alias /sf to lib/vendor/symfony-1.4/data/web/sf. Refer to the LAMP HOWTO for the
procedures. Upon (re)starting your httpd, you should be able now to see the Symfony
Congratulations page.