How to start with Symfony2 framework: tutorial for beginners

How to start with Symfony2 framework: tutorial for beginners

If you want to begin studying Symfony web development, this
Symfony2 framework tutorial by our developer could be very
useful for you. However, if you want to hire a Symfony developer
for building an amazing website, you’re always welcome!

This blog post describes what Symfony2 is, what tasks it solves, what to expect and what to prepare for if you decide to study it.

What is Symfony2 framework?

Well, Symfony2 is a great PHP framework to create web applications that uses the MVC pattern. The framework is easily scalable to fit the needs of the project. A well thought-out application architecture allows to quickly enable/disable the required Symfony2 packages (bundles) in your project with the help of composer.

What should you you know to study Symfony2?

Symfony2 framework requires good knowledge of OOP (Object Oriented Programming), so if you are not sure of your skills, I highly recommend you to revise/study. This will significantly increase the speed of studying the Symfony2 framework, because any program element is a class, and it is critically important to understand its behavior.

Using Doctrine for working with databases in Symfony2 framework

To work with the DB (database), the framework uses Doctrine (you can also use Propel), which by itself is an excellent tool for working with databases, and in combination with Symfony2 becomes an absolutely indispensable tool that is easy and pleasant to work with.

In the beginning, it may seem easier to work with SQL easier than with Doctrine ORM, but it's worth spending a little time to study the Doctrine ORM (DQL) approach, and the sophisticated approaches to "communicate" with the database will open to you.

Twig in Symfony2 framework

By default, to work with HTML, Symfony2 uses twig. It’s a powerful tool for template manipulating that allows to build almost any architecture of templates that can expand each other.

It should be noted that twig has its own syntax, it is quite simple, so the study should not be a problem. Instead, we get a set of tools that are absolutely indispensable to work with the data in the templates.

More information about twig can be found here.

Symfony2 configuration files

Symfony2 allows you to select the types of files (yml, xml, php, annotation) where the settings for the application will be saved. What type of configuration files to use is a matter of choice.

Symfony2 packages

A special attention should be paid to packages in Symfony2 framework.

Lots of ready-made software solutions that can be used in your project have already been implemented. This may include the admin panel functionality, file uploading, integration with payment services/social networks, registration/logination, localization solutions and an incredible amount of other very useful things! So if you have an idea to develop some new features, I strongly recommend to spend some time on finding ready solutions, because, most likely, someone already has done this before you. In case of successful search, you can save a lot of time.

Instead of a conclusion

Symfony 2 framework performs a huge amount of routine work that can "bear heavily" on the developer every day. This makes development faster and allows you to focus more attention on the business logic of the application.

13 votes, Rating: 4

Read also


Hello, everyone! The release of Drupal 8 is almost here, but its beta version is available for use now. So let...


In Symfony, there are many console commands to help you in your work. In this article we consider the most frequently used Symfony commands.The tutorial should be very useful for those who are...


Happy Tester’s Day to everyone! :) Check out the new blog post on QA testing in BrowserStack from InternetDevels Company. And...


Discover the blog post on social shopping projects in Drupal with some of the best secrets of ecommerce...


To create a simple website on Drupal 7, an administrative interface and a simple text editor will be enough, but when it comes to more serious projects, you cannot do without additional Drupal web...

Need a quote? Let's discuss the project

Are you looking for someone to help you with your Drupal Web Development needs? Let’s get in touch and discuss the requirements of your project. We would love to hear from you.

Join the people who have already subscribed!

Want to be aware of important and interesting things happening? We will inform you about new blog posts on Drupal development, design, QA testing and more, as well news about Drupal events.

No charge. Unsubscribe anytime