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 Drupal development agency
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 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 spending 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 web developer every day. This makes development faster and allows you to focus more attention on the business logic of the application.

14 votes, Rating: 4

Read also


You need a web developer to create a website, app or something like that, but do not have the full web studio in your staff? In XXI century the majority of companies face this issue and find that...


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...


When the work on your website development is accomplished, there comes this exciting moment. Your new website is ready to start its successful journey into the world...or, better to say, the World...


We have been working hard, and finally our efforts are evaluated: InternetDevels is on a list of 12 Top...


The new Drupal website support service DruDesk by InternetDevels has already gained a lot of happy customers. Yes, people like when all their problems are solved...or, better to say, dissolved in...

Subscribe to our blog updates