Symphony of PHP – Symfony 4

Symphony of PHP – Symfony 4

You have probably heard of PHP framework called Symfony, today I will share experience with this 
fantastic framework. You can basically do everything in Symfony, but the most essential question you 
should ask yourself is: Should I use Symfony for my application? To help you answer this question, 
I will try to explain basic concepts, give my thoughts and share some experiences of e-commerce 
development.

What is Symfony?

Today Symphony is one of PHP's most powerful frameworks. Because many applications use its 
components, and many of them are built as Symfony applications. The actual definition goes as 
follows.
"Symphony is a set of reusable PHP framework and a PHP components for building web applications
APIs, web services and Microservices.

Who is using Symfony?

One of the most popular applications is Drupal, Laravel, eZ Platform, Sylius, OroCRM, Pimcore
Furthermore, I will write about who and how it is used on e-commerce platforms.
Demystification: However, we will talk about Symfony 4, but most of the concept will cover Symfony 3
First, you should consider if you need Symfony's components. To do this, you must understand that the 
Symfony framework is best used on "large" applications, but it can also be used on a simple application
Symphony of PHP – Symfony 4
Architecture: In Symfony 4 you can find the basics of PHP OOP framework, such as router, controller, 
view and model. In addition, the application flow is incredibly simple. The kernel is the main application 
class, it is responsible for basic application setup (package init, request handle, setting basic folder 
settings, service container initialization, response output, etc.). Since the last major Symfony version
there is no need for manual editing of Kernel - Flex will take care of it (in another file called bundles.php). 
A router is responsible for matching the controller, and the controller is the "entry" point for your app logic. 
Models and views are self-explanatory, the same as on all MVC frames. 
Bundle system: Bundles are same as to plugins, but even better "and you can use them to better 
organize your functionality. There are many core bundles, but there are also community packages. 
They have an input class, custom folder structure for controller, views, configuration, public files and tests
can be overridden, and some of them can be a handful if you want to change their behavior
File structure: Symfony 4 introduced a new (improved) file structure, it was an incremental adjustment for 
new best practices and functions. The folders such as bin, src and var are still there, but some folders have 
been deleted and some new ones introduced. The test is placed in the tests folder, the views are now in the 
templates folder, config is under config and the publicly available files are public. Most of the work is done in 
the src and templates folder. The folder is created on demand, which means that if you do not use a component 
responsible for the specific folder , the folder will not be created.
Components: Symfony components are a set of reusable PHP libraries. "They must be required by Symfony 
because they are not included in the installation. This is so that you can decide and only use the ones that are 
needed for your application. 

Flex: According to official documentation, Flex is a “Tool that replaces and improves the Symfony Installer 
and the Symfony Standard Edition. Flex is used to install and remove bundles and other components from 
composers, in fact it is a plug-in for composers. The best example of this is a comparison of older Symfony 
versions and version 4 that includes Flex in bundles. In short, Flex now does most of the work for you, 
such as installing a bundle and adding it to the bundle list.

Symfony is well documented, rich in framework, but has a large learning curve. That's why it can be a bit 
difficult for junior developers in the beginning. That is why we are here to share our experiences and knowledge.

If you want to learn PHP to make their career as a PHP developer, then visit PHP training in Chandigarh 
website to get details about PHP Course.

Comments