Setting up a Symfony project - the official way, and then some
Posted in Serverside on October 7th, 2009 by Erland – Be the first to commentAfter having tried several different ways of installing/setting up Symfony projects, I have settled for what is more or less the official “best practice”, as suggested by the makers of Symfony. For the purpose of clarity, I will use the example c:\demosite in the following explanation. The example is based on an installation on Windows XP, but can be adapted to suit OSX.
- Create the project folder
c:\demosite - Create the subfolder(s)
c:\demosite\lib\vendor - In the
vendorfolder, do a SVN checkouthttp://svn.symfony-project.com/branches/1.2/ => c:\demosite\lib\vendor\symfony. You should now have a singlesymfonyfolder in yourvendorfolder - From the project root
c:\demosite, run the following command:lib\vendor\symfony\data\bin\symfony generate:project demosite. You may or may not have to prefix this command withphp, depending on your setup. - From now on, you can use the command short cut
symfonyfrom the project’s root folder.
TIP#1:
Copy the file c:\demosite\lib\vendor\symfony\data\bin\symfony.bat to the project’s root folder, and rename it sf.bat. You now have an even shorter command sf at your disposal. Test it by typing sf -V.
TIP#2:
Change the following in the project’s configuration class:
//c:\demosite\config\ProjectConfiguration.class.php require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
TIP#3
If you use SVN to maintain your project, you can use svn:externals to embed the Symfony library in your lib\vendor folder, thus benefiting from the updates to this particular branch.
