Question that arise for many new projects with PHP as their main back end language which web framework should I choose. How can you make a decision between Symfony and Laravel?
These two PHP web frameworks are currently the two most used. They have a lot in common and Laravel actually uses some parts of Symfony, but in the end its a world of its own. Even though they have a lot in common, they also differ in many ways from each other. The basic object oriented model and model view controller pattern is in the heart of both.
Symfony has been a very successful web framework because it has successfully modularized itself and allow a lot of freedom in style. You can only use certain parts of Symfony and not follow the “Symfony” way of doing things. Symfony also extends greatly and has great documentation and large user base to support you.
It is easy to integrate into and can stand as a solid structure around your old code base. Symfony has a lot of ways of doing things and as the framework doesn’t really strict you to one way, you can choose your own path. This is the biggest concern for new Symfony projects. Because there really is no mandatory structure you can do what ever you want and end in chaotically structured application. The basis is also kinda old and there aren’t standardized REST guides to help you do modern structures for website.
Speed of development in Symfony is good. You can rapidly develop a fully functioning little website with some little features. But when you get into a large system stage you’ll start to take a lot of time doing many things related to entities and their controllers. Because there is no one true way of doing things you can easily go wrong and push yourself back a good time.
The best thing is also the worst. The easiness to do things in Symfony is a two edged sword, it might give you great results but in the other end might stab you in the back. To overcome these problems, try to separate code and structure it well. Follow the best practices and don’t let code turn into spaghetti.
Laravel is the new kid on the block when it comes to PHP web frameworks. It is a young framework from 2011 and has gradually risen in to the peak positions of most followed and used web frameworks. Laravel is more web framework than Symfony. It offers very much tools and preferred ways of doing things. The user base is rising all the time and new versions with great documentation arise on a regular basis.
Laravel projects should be started as new projects as there is no clear integration possibilities to old code bases. Laravel lets you do a lot of things freely but also restricts you in a sort of way that you don’t end up in a chaotic situation. Laravel tries to keep your code base clean and well structured. Laravel is more modern framework and it has lots of modern tools attached to it. The templating system is pure and simple and combined with support for nodejs task processing, it offers very good front end solutions straight from the box.
Laravel and its controllers are made for RESTful services. The framework tries to guide you into the REST world and you’ll probably end with good solution if you follow the official documentation.
The development process is really rapid as you can use a lot of techniques featured in Laravel. These techniques and tools make the development fast and efficient. It kind of restricts you to one way but this way is a really good way of doing things.
The best thing in Laravel really is that it makes you focus on structure and create good code. It doesn’t offer very much space of movement but more enough to do complicated things. To master the framework well you will have to through a long journey. But you can get started very very easily and you’ll go through amazing learning process into the Laravel world.
As we can notice from the reviews of the two there are one main factor that differs these two.
The Symfony way is not really a way, it’s more a set of tools you can use to build your website. On the other hand Laravel is a way of doing things and doesn’t give you as much freedom.
I have used both of them and personally I find Laravel to be more friendly and better web framework than Symfony. When going into Symfony and starting a project, you don’t really have one place to start the pieces are all over the place and there is no clear signaling to do things. You will find your own way and eventually end up refactoring a lot of code just because you didn’t know somethings you knew once your project gets to a more mature state. Laravel tries to keep you doing good and well structured code from the beginning and doesn’t allow you to go through the easiest route.
With Symfony I’m sure you’ll learn a lot about programming in general while in Laravel you’ll sort of already a way of doing things. While the Laravel way is really good you don’t get the same experience as you would with Symfony. But because Laravel makes the development so rapid and don’t you do foolish things as easily, it is the clear winner for me when choosing a PHP web framework.
I’ll just leave the current Google Trends chart here at the bottom. From this we can verify that Laravel has taken over a big part of the PHP world. The updates for Laravel seems to be good and the framework is really stable and production ready. So if you are trying to figure out which framework to go with, think about your project and what you want to achieve and how. Laravel makes rapid, solid and efficient development in Laravel way. But Symfony gives you more freedom.