Why We Use Symfony
By: Maygen Jacques
Tags: Drupal Development, Drupal, Web Development, Framework, Symfony

What the framework is and why we think it’s a great choice for us as a Drupal agency

Web development is a lot like how a watch works. Each part of an application needs to function correctly and integrate perfectly to respond to what the user wants. This is similar to how the components of the watch mechanism have to move flawlessly so the second hand can continually and accurately sweep across the dial.

So, let’s talk about how that happens using Symfony.

78.8% of all websites are created using PHP (W3techs, June, 2020).

A website or web app can be purely built in PHP or, at least, one of its frameworks. This is dependent on how complex the app is or the timeframe of development. Other factors like how experienced your developers are can also come into play.

Symfony is one of the most popular frameworks available. Here at Code Enigma, we touch Symfony every single day. In fact, our client dashboard was written in Symfony as well as being a major part of our project work.

What is it? Why do you need it?

If you’re not a techie, don’t worry. We’ll quickly explain what a framework is before we tell you why Symfony is great.

A framework is essentially a collection of universal and reusable programs. They complete specific tasks that contribute to the development of software applications.

Let’s use another metaphor.

Imagine Symfony is a blank canvas for what will become a website or web application — which is the final artwork. In that you would need to use paint to create your artwork, a developer needs a framework in which to place modules and features.

A framework isn’t mandatory. It’s a good idea, though. It makes the process a lot simpler and smoother. Otherwise, you’ll end up with paint all over your hands.

Here’s how using a framework makes life easier:

Faster development

You can win back up to three days of development time if you repurpose out-of-the-box components. This time can be utilised for features that aren’t MVP.

Fewer issues

The coding of the framework is clear. It’s also been proven already. This reduces the number of errors.

More secure

The framework components are subjected to regular security updates

We’re not saying Symfony is the best for everything. There is no one size fits all and we firmly believe in working with a client and their team to understand the business and project objectives first, so we can create the best solution from there using the tools we know.

Any given framework will only be as good as the developer using it. If you have an expert developer, you can trust the solution.

Efficient maintenance

Adopting a framework gives you a structure to start with and some basic rules to follow. A new developer could join and immediately have an idea of where to start on a project that’s already kicked off.

Is Symfony the best, or not?

We won’t categorically say it’s the best. It’s got a solid reputation as one of the most reliable, mature PHP frameworks:

Highly-flexible

Symfony is feature-rich. Two things make Symfony outstanding and those are Components and Bundles.

Components are generic features that decrease routine tasks, allowing a developer to focus on a more specific business feature. There are 30 Symfony components that catalyse the development process. You can use a component independently and add custom modules without causing any issues to the architecture. Some Symfony components can be used in a stand-alone way in other frameworks or plain PHP solutions.

Bundles are, essentially, like plugins. It’s a little parcel full of files (JavaScripts, images, stylesheets and PHP files). Bundles are decoupled. You can reconfigure them for reuse for a variety of applications, which reduces the overall cost of development.

Both components and bundles are composable, allowing a developer to quickly bolt together functionality. The benefits of having an application that consists of just the things you need are that it’s easier to make changes without breaking anything along the way. Meaning, you can tailor your solution to user scenarios and specific requirements and therefore have a flexible application.

Commercially supported

Symfony is one of a few commercially backed frameworks. You can attain certifications. You can attend conferences. You can receive official tutorials. They’re very serious in their intentions and this oozes credibility.

Reliable

This framework has proven itself over a long period of time where we’ve seen other frameworks diminish in popularity. Symfony’s longevity is further ensured by the fact other systems and frameworks have chosen to take Symfony and build on top of it, including Drupal and Laravel.

Ease of testing

Symfony boasts more than 2,000 contributors, that’s an impressive number of diverse and knowledgeable people, all working on the code that will power your next project if you choose to base it on Symfony. Every new line of code written should be tested to ensure it’s stable for use in an application. Reusing bundles and just the components you need (all built on good practices and established design patterns), combine for better maintainability and testing within Symfony.

Support for the long-term

Symfony is a stable and well-tested framework with regular updates. The most recent versions stay long-term supported and compatible with the newer releases: up to 3 years for some of the versions.

Supportive community spirit

What we love about Drupal is the community that comes with open source technology. A similar scene exists in the Symfony world, too. One of the most influential factors in keeping a framework alive is the community driving it. Symfony boasts more than 2,000 contributors, that’s an impressive number of diverse and knowledgeable people, all working on the code that will power your next project if you choose to base it on Symfony.

You might wonder why that’s important. PHP experts, as well as core developers, work on optimising the framework. The code improves thanks to the collaborative expertise. New components are created, issues resolved and people mentor and learn, pushing everyone forward.

Excellent documentation

A lot of technology is guilty of harbouring out-of-date or incomplete documentation. Symfony’s is up there with the best in comparison to alternative PHP frameworks.

It’s written incredibly well, with clear structure. It has examples and is updated with every new version. You’re able to find a detailed explanation for every component, even the development process as a whole.

Symfony and Drupal

We see many benefits as Drupal developers:

We save time that would otherwise be used for solving issues or writing and maintaining code that’s already been written and tested by others.

It means we don’t have to reinvent the wheel every time we start a new project. Symfony gives us access to tools for a lot of common tasks that recur for a lot of projects.

To an extent, it forces us Drupalists to use endorsed, tested and maintained code from elsewhere. Meaning, we step outside of our Drupal bubble to learn something new that adds value to the project. We might even be able to step away from less-than-ideal Drupal solutions in favour of a Symfony solution.

It promotes decoupled code.

It also invites standardisation of best practises.

Summary

Hopefully, this sheds some light on what Symfony is and why it’s our framework of choice as Drupal experts.

We’d love to chat about your upcoming projects. Contact us!