Apr. 5 2011

Changing application names in Symfony

It’s generally frowned upon in Symfony to change your application’s name. To be honest, I thought it was just going to be a lot of hassle. Thankfully, it wasn’t and here’s how to do it:

First, rename the application directory to reflect your new application’s name. The directory will be in < sf_root >/apps/. In the “Getting Started” guide, you generate the application frontend, which is what I’m changing mine from. It can be anything lower case as long as it doesn’t have spaces, underscores, or that sort of thing. I changed mine from frontend to panel. For you techies, here’s the regex the application name compared against in the application generation task:


Next, go into each of your environment’s files in the < sf_root >/web directory (e.g., frontend_dev.php and frontend_staging.php). These are the files that you access when you go to different environments for an application. Change the line where it retrieves the application configure so that it matches your new application name. In the example below, change the 'frontend' to match the new name:

// frontend_dev.php
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true);

Don’t forget to change index.php! It’s for your production environment.

You should also rename each of those files to match your new application name. It’s not going to mess anything up if you don’t, but you may get confused later on down the road!

Now, go into the application’s configuration directory at < sf _root >/apps/< application >/config. It’s where you see all your YAML configuration files for your application. Look for a file that looks like < application >Configuration.class.php (e.g., frontendConfiguration.class.php). In the file, you’re just going to rename the class to replace the old name with the new:

// frontendConfiguration.class.php
class frontendConfiguration extends sfApplicationConfiguration

Go ahead and rename it to match your application’s new name (although, like the web environment files, it doesn’t have to be because it’s automatically loaded anyway due to its location).

Finally, clear your cache using the command php symfony cc from your Symfony root directory.

Leave a Reply

Previous post:

Next post:

Last.fm interface from fmTuner (modified by me).

Twitter interface from HL Twitter.

Dedicated to my mom, Sharon. May she rest peacefully.
Love you always. (March 23, 1965 - November 12, 2011)

Unsupported Browser!

My site is designed for and currently displays best with modern browsers (and it looks like you don't have one!).

Everything should still function properly, but you won't be able to see all the fancy effects, text, or the way I intended my design to look.

Consider trying the latest version of either Firefox or Chrome... I think you'll like it!

Logan Bibby

P.S.: You can continue viewing my site by clicking the "close" link and you'll never see this again. :)