Symfony2 vs Yii2: which development framework should you choose this 2017?

23rd
May
2017

Comparing systems that are equally popular is a pretty hard task. Such comparisons are by default prone to inaccuracies, particularly if you favor one of them. Essential in the updated version of the article we’d like to take an unbiased approach towards Symfony2 PHP construction vs Yii2 question and let our readers choose by themselves what to choose for their projects.

 

Symfony2 PHP web construction vs Yii2

 

Symfony2 and Yii2 are both full-stack PHP frameworks. They the two are open source products with code available on Github. Documentation for Symfony2 and Yii2 comes in several languages, including Russian. However, in Yii2 applications are created according to MVC whilst in Symfony2 only model and controller part of the pattern are used. Both Yii2 and Symfony2 use namespaces that allow developers to isolate components, widgets and models from each other. It was a long-expected feature for Yii1 users since when the structure of the product is organized this way, it’s much simpler to write code.

 

So what do you need to do to get started on working with each one of these frameworks?

 

Installation

 

Right now there are 2 different ways to mount Yii2 framework. You can either use Composer or do it manually. Developers recommend doing it with Composer which is convenient since later you may easily install extensions and update framework by typing commands in Composer.

 

The same two ways of installation are around for Symfony2. But its developers recommend using installer to accelerate the process of creating your web app. However, it is also possible to utilize Composer, just like with Yii2.

 

After installing Yii2 you obtain a web iphone app crated with basic theme but you can also install advanced template. You can even create your own Yii2 template if you want. Symfony2 has a demo iphone app too but you need to run a special command to install it. At the same time there’re several Symfony2 droit that are ideal for creating programs with certain functions, for example:

 

Standard edition is installed by default.

Hi World Edition is utilized for creating benchmarks.

Symfony CMF Standard Edition is employed for creating CMS.

Symfony SLEEP Edition has all the required REST functions.

 

 

Development process

 

PHP development frameworks were created in order to eliminate task repetition. Yii2 wins more hearts than Symfony2 as it pertains to development pace as it significantly reduces the expansion time. As a result, you spend a fraction of the time on repetitive duties, and spend the better part of your work hours on customizing your web applications.

 

Yii2 has a special module for code generation called Gii. It truly is visual, runs in a browser and allows you to easily create the following elements:

 

Active Record classes;

forms;

controllers and views for CRUD;

new classes for remotes;

skeletons for modules and files for Yii2 plug-ins.

But if you happen to prefer command range, check out Symfony2. Skeletons for bundles, forms and CRUD controllers in Symfony2 are produced with SensioGeneratorBundle. As for routing, here Symfony2 scores more factors — it has versatile settings for imported paths, as well as conditions for customizing routes.

 

This should be noted that Yii2 is delivered with Bootstrap and also has ready-to-use widgets and styles. In this regard Symfony2 is less suited to frontend developers — you’ve obtained to add everything by yourself. Symfony2 also has no build-in widgets.

 

 

 

Typically the most popular bundles for Symfony2 are:

 

FOSUserBundle is created for user management (sending user data into DEUTSCHE BAHN and getting data from it).

FOSRestBundle provides tools for building REST applications.

KnpMenuBundle allows you to create object-oriented menus.

StofDoctrineExtensionsBundle can be used for integrating DoctrineExtensions into your project.

LiipImagineBundle allows you to change images with Imagine collection.

What uses Yii2 for performing these functions?

 

Regarding user management — yii2-user-management extension.

For REST — yii2-rest extension.

For creating menus — Menu golf widget (yiiwidgetsMenu).

For working with data bases — ActiveRecord ORM.

Both Yii2 and Symfony2 allow developers to use third-party libraries in their projects. It is created by installing them with Composer, then configuring and including them in autoloader.

 

“Symfony2 vs Yii2 framework– which one is way better? ” is a question with no answer. But, based to our observations, Yii2 is loved because of its simplicity and fast performance, as well as solid MVC architecture. Easy-to-learn API is also often mentioned among its strengths. As for the drawbacks, routing in Yii2 isn’t very powerful. Big amount of widgets can also influence the learning curve.

 

Advantages of Symfony2 include flexible routing, in-build cache system, as well as Twig utilization (but there are a way to use Twig template engine in Yii2). A large number of entities is often considered a drawback of Symfony2. And annotation syntax has its objectors too.

 

Easy installation, namespaces, good testing capacities and a number of extension cables are peculiar to both frameworks. But in the end the best way to select from Symfony2 and Yii2 is to set up them both, try to write an application and see what will do the job.

Share it with your friends
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedIn