Community Post

How to Deploy Github Code Automatically.


For beginners and intermediate PHP developers, graduating to using a framework means that they have achieved the pro status. However, once the decision has been made, the next major hurdle is the choice of the right framework. Luckily, the rise of Symfony as the go-to platform for mid and large scale PHP development projects has solved this problem.

Symfony is well known for being a comprehensive framework that is ideal for all sorts of projects. In particular, it greatly streamlines the development and maintenance of business websites. Written from scratch in PHP, Symfony is a tried-and-tested development framework that runs equally well in both Windows and *nix environments and integrates well with all major DB engines.

Symfony greatly simplifies development by taking care of tasks that distract developers from the main theme of the projects. By providing scaffolding and basic nuts-and-bolts of the project, Symfony allows the development team to focus on the implementation of business logic rather than worry about the quality of code and minor source-code level problems.

What You Should Know Before Diving Into Symfony

While Symfony is positioned as a framework that welcomes developers of all skill-levels, there are certain concepts and skills that should be very clear before you start using the framework. Despite excellent documentation, a very helpful community, and a wealth of resources online, you should be well equipped with the following prerequisites for the framework.

A Solid Grip on PHP

Although it sounds like a no-brainer, it is surprising how many beginners think they could start web development using Symfony without a solid foundation in PHP. Symfony is written in PHP and utilizes all major concepts of the language. The fact that the framework provides shortcuts and simpler methods that hide the complexities of the code is no excuse for attempting to use Symfony without thoroughly understanding the usage and syntax of PHP.

Object Oriented Programming

Another important reason why you should have a solid grip on the concepts of PHP is the fact that PHP, and by extension Symfony implements all the major concepts of Object Oriented Programming (OOP). Without understanding the major ideas of the programming paradigm, you will be completely lost in the complexities of objects, methods, encapsulation and inheritance. It is best to understand the basis of OOP and learn how the theoretical constructs and ideas are implemented in PHP.

Model-View-Controller Architecture

Symfony fully implements Model-View-Controller (MVC) web application development structure. In fact, it is the only app development structure available in the framework. In its essence, MVC architecture comprises of three interconnected components that determine the overall structure and operation of the app.

The first component is the Model that contains the functional logic of the app. This is the level where business logic, rules and information is processed.

The second component is the View that contains the visual elements of the app. This is the component that presents the user interface(s) and other user facing elements of the app.

Finally, the third component is the Controller that sits between the Model and the View of the app. Controller collects and analyzes user input and then engages either View or Model (or both) to collect or present information and data.

The main reason why MVC architecture is the preferred way of developing web apps is that it isolates all three components so that changes could be made to any component without creating problems in other parts of the app. For instance, you could create multiple Views of the app for different screen sizes without breaking the operational logic of the app. Similarly, you could modify (or completely re-implement!) business logic of the app without worrying about breaking the UI/UX.

Twig Templating Engine

Before diving into the benefits of Twig, it is important to understand what templating engines do.Templating engines provide clean separation between the presentation and logic of the app. Although this sounds similar to MVC architecture, it is actually a subset of the overall concept.

Symfony uses Twig as its primary templating engine. Thus, you could use Twig to define and develop the UI/UX elements of the app without worrying about its logic. The most important benefits of using Twig are its speed and ease of use. The code generated by Twig is lean and integrated with the rest of the app without any major issues. Thus, the developer could generate a large number of pages without much effort.


Given the scope and complexities of an average web app project, a number of libraries, classes, and packages are in play at any time. For any developer, it is impossible to keep track of which libraries or packages are included in the projects and which libraries or packages are referenced by the code. These lost connections often result in mysterious bugs that are hard to track down.

Fortunately, Symfony uses Composer, a dependency manager that takes care of these issues. You just need to declare what libraries you need for your project and it takes care of the rest. It discovers the second level dependencies and installs appropriate versions of all the libraries.


Bundles is a core concept in Symfony. A bundle is a set of files that delivers a single functionality for the web app. In a way, bundles resemble plugins of WordPress but with a significant difference: everything including the native functionality of the Symfony framework is a bundle in itself.

A bundle comes with all the PHP files, templates, CSS, JS files, and anything else that is essential for the particular feature that the bundle delivers. Symfony offers a large selection of bundles that incorporates a wide range of functionalities in any web app. However, if you think that the supplied bundles are not adequate, you could always opt for a third-party bundle that is custom built for your specific requirements.

If you wish to build web apps using Symfony Framework, you should be very clear about these concepts. Some of the concepts such as solid grip on PHP and OOP should be acquired before dabbling into the framework. Others such as MVC architecture and Twig can be picked up after some experience with the framework.

Cloud Hosting

Since all developers love to develop symfony apps while hosting it on Cloud servers. you can also develop on localhost and then host your application. I personally prefer Cloudways PHPstack for PHP hosting my symfony Applications. They provide Dedicated servers for Symfony applications with wonderfull performance benchmarks. You can create an account and then copy your files on it.


3 posts

Shahroze is always in search of new frameworks and methods to implement them. He is a big fan of PHP development and managed cloud hosting . Besides his coding life, he loves movies and playing soccer with friends.