Tag Archives: Symfony 2

Symfony is a PHP web application framework for MVC applications.

Symfony 2: Creating a Bundle

As discussed in this and this post, Symfony 2 is a web application framework. In Symfony 2 we organize our code in form of bundles. You can think bundle as collection of all code. Say if your app has a front-end, a back-end and an API then you can create three different bundles one for your front-end, one for your back-end and one for API. This will allow your to manage code efficiently.

Symfony 2 is flexible and it allows you to have as many as bundles you want in your app. Let’s understand this bundle system in detail by creating a bundle.

Continue reading Symfony 2: Creating a Bundle

Understanding Directory Structure of Symfony 2

Symfony 2 is a PHP framework. When you download it, if noticed, Symfony 2 has a directory structure. By default there are 5 directories like app, bin, src,vendor, web. If you had developed any kind of application with Symfony 2 then you might have followed something like put your source code in src, put all static assets in web, write config files in app etc. Again this directory structure is configurable, that means you can customize it according to your project needs. Even though the directory names are self-explanatory, let’s have a deeper look of this structure.

By default Symfony consists of following directories,

  • app/: The application configuration
  • src/: The project’s PHP code
  • vendor/: The third-party dependencies
  • web/: The web root directory


‘app’ directory in Symfony 2 holds the application configuration. You can find all configuration related stuff in ‘app/config’ folder. If you need to configure your database or Swiftmailer then you will need to change parameters/settings from here. Apart from that this directory holds the ‘cache’. While writing code in Symfony 2 you will be working with lots of files ranging from xml, yml to php, twig, html etc. Controllers will be written in some file, routes will be defined in some another files, views will be written in some other file and so on. So while serving request Symfony has to read all these necessary files. Since the count of files is too high, to achieve great performance Symfony 2 has inbuilt caching. And this cached data will be stored in ‘cache’ directory. Again there is a ‘log’ directory which has debugging related data, especially useful in development.

Continue reading Understanding Directory Structure of Symfony 2

Getting Started With Symfony 2: Quick Setup

If you are a web developer then you might have heard something called as “Symfony“. So what is this Symfony? Framework? Language? Tool? or something else? Let’s have a quick look on this.

What is Symfony?

Symfony is nothing but a set of reusable PHP components, a web application framework. Symfony is a leading PHP framework, which has a large user base and used to create websites and web applications.

Symfony is basically set of components. Depending on your needs, you can either choose individual component, you can choose set of components or you can go with full framework. Before going to Why Symfony? Let’s first see why you should use a Framework?

Continue reading Getting Started With Symfony 2: Quick Setup