symfony tips: Global app.yml for Multiple Applications

I will be writing several posts related to tips I have learn or discovered in developing websites using symfony. For readers who don't know that symfony is, it is a PHP 5 based wed development frame which enables developers to rapidly build feature-rich websites by providing a set of reusable codes and common tools required by day-to-day web development. You can read more about symfony here.

Today I am going to show you a very simple tip. Here's a typical symfony project directory structure:

Notice that under apps there are two applications, namely "backend" and "frontend". Each application can have its own "app.yml" file, which is used to store application settings. "app.yml" is typically located under "config" folder of each application.

So far good. Right? What if you want to share settings across all of your application? symfony provides a very easy way to solve this problem. That way to do this is to simply move the "app.yml" configuration file from your application's config folder to project's config folder.

That takes care of it. Whatever you place in Project_Root/config/app.yml will be available to all applications within that project.

Of course each application can still have its own app.yml. Since the configuration is cascaded, when there are identical settings in project and application settings, application settings will overwrite project settings.

This might have been documented in the official documentation, but I couldn't find myself. So I made this available for who are having the same question.

1 Comment symfony tips: Global app.yml for Multiple Applications

  1. Pingback: Using app.yml options in your tasks | imluxin

Comments are closed.