Symfony is a widely used PHP framework for building large-scale web applications , and its library is also used as a platform for many systems such as Magento 2, Drupal 8, phpBB … Projects. famous project using Symfony .
It is easy to see that Symfony is the most powerful and standardized library available today. If you are a follower of PHP, then it is missing when you have never heard of that name.
I am not afraid to announce that a fan of Symfony is currently eating with Magento. Previously, I used Symfony2, but later switched to many other technologies, but I still love this framework because of its scientific scientific structure. So far 6 years (2012-2018) Symfony has been up to version 4, on the occasion of re-understanding “old love”, I wrote this article to describe more about Symfony for you to learn and introduce https://dienmayphatdat.vn/ is one of websites using Symfony Framework. New features, new principles in Symfony4 .
The symfony is a web application framework written in PHP language, and it’s free. Unlike other types of frameworks such as Zend or CodeIgniter that build their own libraries, Symfony includes many components, different libraries combined into one system, complete application . This is similar to the sentence “1 hand does not work, 4 hands are bunched up into a casino”, so instead of 1 company building 100% of applications, Symfony will integrate the essence of 10 companies to make 10% of my application. That is the origin of the name Symfony – Symphony means “symphony”, as a symphony orchestra with countless instruments, artists and concerts to create melodious melody.
“Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community – all working together in harmony. »
Is that a mess?
The combination of the most advanced technology is probably not the best, for example, your house has all luxurious furniture, genuine TV, big fridge … But messy arrangement only takes up space and you will crazy if you live in a house like that:
Of course that doesn’t happen in Symfony, SF’s ingenious designers cleverly handed the initiative to users, first when installing SF will be the simplest version, after which you want to add features. , you install component for that function, operation, Symfony library loading all.
To use the language translation feature for the website you need the translation library, then you will run the command:
composer require symfony/translation
Then you define the default language in the configuration file:
And write translation text in:
How many components are in Symfony?
There are about 50 components for Symfony, each with its own unique function and high reuse. Symfony components include code and documents . You can even use them completely independently from Symfony Framework, thanks to this liberal nature, other frameworks can easily “pregnant” with Symfony, such as Magento2, Laravel, Yii, CakePHP … That is to use. component built by Symfony in its core.
You can do anything with Symfony
Actually Symfony is very “Imba”, unlike traditional Library Frameworks, the Symfony community today has built many platforms that meet all the complex business needs of Product Information Management ( Akeneo PIM ), Content Management System ( eZ Platform CMS , CMF ), Customer Relationship Management ( ORO CRM ), eCommerce ( Sylius eCommerce ) … And can you believe it? The whole thing is Open source – it’s free! Software is like sex: it’s better when it’s free.
Previously, Symfony encouraged programmers to organize applications into bundles, ie specialized code blocks (modules), such as FrontendBundle for Frontend for customer and client, BackendBundle for admin and manager.CMSBundle and EcommerceBundle for 2 content management and e-commerce features …
But from version 4 Symfony encouraged to remove all bundles, all written inside a single folder is
The reason Symfony wants to simplify the application. There are schools in web application architecture, 1 is micro-applications or micro-services application subdivision, 2 is monolith 1 architecture. Of course, any architecture has its advantages and disadvantages, depending on the size of the application for you to choose. Fortunately, Symfony claims to support both types of architectures, although actually the most accurate version of Symfony is suitable for one-block type, your code using component symfony is located in the vendor, module subdivision and resolution. The problem depends on each other, the relationships between them only make you more troublesome, make it simple .
Symfony Applications go minimal
At the time of version 2, Symfony was famous as alcohol because of its superior strength to smash the stains … Well, I was mistaken through washing powder. Generally very strong, but one drawback is that it is too strong, so it is heavy, not suitable for small applications. But for a long time, with Symfony 4, your vendor was streamlined to the maximum to implement a basic web application.
When you need some functionality in components, run the
composer require command, then Symfony will download and configure it for you to use immediately, Symfony calls it developer experience .