A short article on how to setup a symfony 1.4 project with SVN

Here is a short article on how to setup a symfony 1.4 project with SVN. This will helps you to have a good start with symfony 1.4.

First, you have to create your SVN repository. There are many tutorials about it, so I wont step into the details.

Let’s assume that our repository is http://svn.example.com/symfonyproject101

From your Dev path environement:

svn checkout http://svn.example.com/symfonyproject101
cd symfonyproject101

This will create a new folder called symfonyproject101 on your system inside which you can code.

Now, we will link the symfony 1.4 repository to this project:

mkdir -p lib/vendor
svn add *
svn commit -m "Symfony installation"
svn propset "symfony http://svn.symfony-project.com/branches/1.4/" svn:externals lib/vendor/

This will link the directory lib/vendor/symfony to the symfony repository. Every times you will do an svn update, it will also update your symfony library to the latest version without pollute your svn repository.

After you’ve saved the directory, run an svn update:

svn update

It will create all the necessary folders and files under your folder:

Fetching external item into 'lib/vendor/symfony'
A    lib/vendor/symfony/test
A    lib/vendor/symfony/test/unit
A    lib/vendor/symfony/test/unit/sfContextMock.class.php
A    lib/vendor/symfony/test/unit/escaper
...

Once you have done that, you can now create the real project with generate:project:

php lib/vendor/symfony/data/bin/symfony generate:project PROJECT_NAME

where PROJECT_NAME is your project.

Run an svn add to your project and then submit it:

svn add *
svn commit -m "Symfony installation"

For the web sf default assets, you can link the web/sf directory to the right svn path:

svn propset "sf http://svn.symfony-project.com/branches/1.4/data/web/sf/" svn:externals web

It is a good idea to exclude the log/ and cache/ folders as well as the web/uploads/ folders from the svn repository because they are unnecessary and will pollute it.

svn propedit svn:ignore "*" ./cache/
svn propedit svn:ignore "*" ./log/
svn propedit svn:ignore "*" ./web/uploads/

And that should be it. You can now work on your new symfony project and commit in your repository without a glitch.

Optional: You can use the svn:external feature for your plugins directory. Example:

svn propedit svn:externals plugins

sfDoctrineGuardPlugin http://svn.symfony-project.com/plugins/sfDoctrineGuardPlugin/trunk/
svn update

This will create the sfDoctrineGuardPlugin directory and update it automatically every times you do an svn update.

Totophe

Creative Mind, Digital Development Strategist, and Web & Marketing Technologies Consultant in Brussels, Belgium

No Comments

Leave a Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.