DEV Community

Philip Perry
Philip Perry

Posted on • Originally published at programming-decoded.com on

Why you should learn Symfony as a PHP developer

As a PHP developer it’s well worth learning the Symfony framework or at least some of the concepts. That’s because so many other projects use Symfony components and some of its architecture under the hood. Personally I’ve seen this in Laravel and Drupal. See a list of projects using Symfony here: https://symfony.com/projects

So what are some things one should take the time to look into?

Well first there are of course the many components. Some of the components Drupal makes use of are: EventDispatcher, HttpFoundation, Routing, Validator and Yaml. Thanks to Composer and autoload it’s very easy to add a component to a project.

Then you will want to learn about service containers and dependency injection. It sounds complicated, but these are actually just ways for creating objects and passing them into your class.

Also read about the Symfony classes that allow you to interact with the HTTP requests and responses. In connection with this, you will want to learn about routing the Symfony way.

Although Laravel comes with its own ORM, Eloquent, it’s good to spend some time understanding the advantages and disadvantages of using Doctrine, Symfony’s preferred ORM. The same goes for the templating engine Twig. Drupal also uses Twig and Laravel’s Blade is quite similar.

In conclusion: While it’s not necessary to know Symfony for working with Laravel or Drupal, Symfony knowledge can give one bigger confidence in tackling any of the many projects that make use of Symfony components and concepts.

Top comments (1)

Collapse
 
teknorah profile image
Norah Shannon

It's especially good to know if you have an adjacent project that is also using Symfony, like Magento!