11/30/2021

Drupal 9 Symfony

Drupal 9 is here and if you’re a web developer or company seeking to have a robust application built, you’d better know about it.

  • Before we begin, you should be able to use Composer as this is the default method to install Drupal core and modules for Drupal 8/9. We will be installing a complete full installation. This is basically Drupal core with Drupal Commerce so you have a working shopping cart out of the box.
  • 9.1.x vendor/symfony/http-foundation/RedirectResponse.php SymfonyComponentHttpFoundationRedirectResponse; 9.2.x vendor/symfony/http-foundation/RedirectResponse.

Drupal 9.0.0 was officially released on June 3, 2020. With new releases happening on the first and third Wednesday of every month, we are currently at a stable and fabulous Drupal 9.1.4.

Trying to upgrade a D8.8.6 site to D9 - karins-MBP:d9civicrm.local sysadmin$ composer require drupal/core-recommended:[email protected] drupal/core-composer-scaffold:[email protected] -update-with-dependencies -no-update./composer.json has been updated karins-MBP:d9civicrm.local sysadmin$ composer update. Drupal 9 is currently scheduled to release on June 3rd, 2020. The Drupal community has been successfully releasing minor versions every six months since the adoption of semantic versioning in Drupal 8. Every minor version came with several valuable new features. Drupal is a great tool for building dynamic, scalable websites using community-created code and modules. But what happens when the community has yet to create a module with functionality needed for your site? You can create it yourself! Learn the basics of module development in Drupal 8/9 to remove the mystery behind how contributed modules work.

Drupal facilitates a first-class development experience by providing a comprehensive, holistic and hardy family of building blocks for constructing complex web applications. At SiteCrafting we have always worked a bit with Drupal, but the stunning evolution that occurred in Drupal 8 and 9 excited us to base our most complicated new projects on it.

What is Drupal?

Drupal 9 is classified as a CMS. What is a CMS? A Content Management System (CMS), the administration-side of a website where site managers can log in and control website content, process orders, manage users, etc. When I started working on websites 18 years ago, CMS systems were proprietary things built from scratch by freelance developers and web firms to handle the needs of their particular clientele. As time rolled on, developers began to notice that they were all solving the same problems over and over again and open-source communities began to rally around favored CMS offerings.

Open-source communities became packed full of talented programmers pivoting away from their homemade CMS and teaming up to strengthen community projects that they and countless others would benefit from. As the years passed, many CMS offerings competed in this space. Decades later the space is no longer filled with scrappy contenders, but a handful of champions each best-serving a particular purpose.

While it is true that the CMS WordPress has become the champion for websites (64 percent of market share), Drupal has emerged with strength as the champion for web applications.

If you’ve ever been hesitant about using Drupal for your web application take it from us, this is the time to jump on board. Drupal versions 1.0 through 7.0, while wonderful in their own way, were built completely by the Drupal team so not only was that team responsible for the quality of the CMS, but for the underlying web framework as well. The result was good enough to keep the community thriving, but one can only do two things half as well as they can do one thing. As new features were introduced, cracks in the form of complexities for developers began to form.

For Drupal 8, the team made a huge decision to consolidate energy and dedicate itself completely to the CMS side of things. The Drupal team decided to craft the CMS on top of the framework and practices found in Symfony, which had emerged as the most adopted, sophisticated and reliable PHP framework in the world.

For the next five years or so, all of the fresh Drupal 8 code built on top of Symfony matured, hardened, and stabilized to the point where Drupal 8.9 was so excellent that it simply dropped any deprecated functionality and itself became Drupal 9.0.0. The resulting Drupal 9 CMS is the most well-organized, secure, powerful, versatile and useful version of Drupal ever.

Symfony Gives Drupal Sparkle

So far I’ve lavished Drupal 9 in lofty praise, but what specifically makes it so great? Several things! First, I must begin with the Symfony framework they based it on. Symfony is, simply put, one of the most brilliant things to happen in the PHP landscape. It is a set of reusable PHP components that are expertly designed, clearly documented and as powerful as you need. It seems there is a Symfony component for just about any need you may have. Need a template engine? You will fall in love with Twig. Need a good ORM for data model behaviors? Doctrine has your back. Need to secure some API endpoints? The Security component will save you countless hours.

Drupal

Every Symfony component tracks its own dependencies with composer (PHP package and dependency manager) so it’s easy to add, remove, upgrade or downgrade components in a snap. Yet, Symfony is just the beginning, as what Drupal has done on top of Symfony is equally brilliant. From the get-go, Drupal 9 anticipates that you will be building something big and establishes a clean system of organization for your views, models, controllers, routes, services, listeners, etc.

Next, Drupal 9 knows what kinds of things a developer needs to do and provides CLI commands, admin center tools, and YAML config that do much of the heavy lifting typically handled in code. Flexible content types, models/data structures, admin forms, web forms, content appearance preferences and more can all be crafted right inside of the admin center before touching a line of code. Using this tooling does not paint you into a corner, as Drupal perfectly strikes a harmony between the concepts of automation and customization.

To Drupal or not to Drupal?

So, how do you know if Drupal 9 is right for your PHP project? To start, I am going to assume that your web application displays content to the public and you’ve narrowed down your choices to WordPress and Drupal. If you need a website to simply display rich content types and perform a few typical bits of functionality, WordPress can probably handle things just fine. However, if any of the following are true you should probably step up to the magic and power of Drupal 9:

  • You are storing or processing a high volume of data. WordPress encourages developers to store data in two tables: wp_posts and wp_postmeta. This is fine for pages, articles, galleries, event calendars, etc. But if you need to store a high volume of data for some reason, you will find that these two tables can become overwhelmed and site performance can suffer.
  • Your application will have related data models. As mentioned above, WordPress encourages developers to store data in two tables. Doing so means that you simply cannot benefit from MySQL relationships or proper indexing. To sweeten the deal, Drupal 9 even supports database migrations so that your entire history of schema changes are tracked and can be deployed to your test & production environments.
  • Your web application has many custom areas. When it comes to organizing and building a large web application, there is simply no substitute for a proper MVC framework with a URL router that forwards requests to actions in controllers. While one may be able to get vaguely near this setup in WordPress, it will never be the same as the real deal. Drupal 9 is a complete web application ecosystem designed from the ground up to empower custom development.

There are more reasons I could think up, but the general idea is that if you are building a web application into your website you should really be using a CMS that is based on a web application framework like Drupal 9 based on Symfony. It does come with a steeper learning curve than WordPress has, but after learning you will be able to do more — and do it all in a more resilient and future-proof manner.

So what about you? Do you need a web application that could benefit from the strength and extensibility of Drupal 9? Fill out the contact form below and let’s talk.

Upgrading from Drupal 7 to Drupal 8 is a major project (a full rebuild in most cases) that can rival or even top the original cost of application development. Upgrading from Drupal 8 to 9 and beyond, in comparison, requires just a tiny fraction of that effort. Here’s a look at why — and why you should take the leap from Drupal 7 to Drupal 8 and 9.

The upgrade from Drupal 7 to Drupal 8 was a major theme for plenty of our clients over the last few years. Drupal 8 — and versions beyond — boast a wide range of benefits that stem from a more modern architecture, but one of the biggest wins in my mind is the advent of semantic versioning (for Drupal) and a renewed commitment to making Drupal upgrades easy forever. Moving to Drupal 8 could be your last major upgrade.

The ghost of Drupal past

The move from Drupal 7 to Drupal 8 isn’t easy. While it’s often still touted as an “upgrade process” the reality is that it boils down to a complete rewrite of the codebase and a content migration. We’ve worked on more than a handful of Drupal 7 to Drupal 8 upgrades in the last years, and the majority constitute a “six months or more” sized project.

One reason for that is Drupal’s new Symfony reliant architecture that leans far closer to the tenets of object oriented programming (OOP) versus the more procedural approach used in previous Drupal versions — a significant technical change which in most cases means Drupal 7 code simply won’t work in Drupal 8. Add to that a completely revamped templating system and you get a similar obstacle on the front-end: Drupal 7 templates & templating systems won’t work in Drupal 8. Those major changes along with a potentially long list of complications with Drupal 8 data migrations is likely to land your Drupal 7 to Drupal 8 upgrade squarely in “rebuild the application” territory.

The good news is that it’s the last time.

Drupal 8 and beyond: Your last major upgrade

Drupal 8, 9 and beyond promise a continued investment in modern architecture, incremental major feature releases, greater stability and sustainability, and a much larger network of invested developers — among lots of other perks. Perhaps the best news to come along with the new Drupal architecture is that large-scale, overhaul-style major version upgrades will be a thing of the past. And we’re beginning to see that now as we begin moving Drupal 8 sites to Drupal 9.

Clearing the road ahead: A commitment to easy upgrade paths

With Drupal 8 comes the commitment to semantic versioning. Semantic versioning isn’t just a naming convention for software versions, it’s a descriptive norm that guides how new versions of code should be written and establishes strict backwards compatibility requirements. The upshot for end users is significant but manageable incremental changes between major versions (say 8.x and 9.x) which aim towards seamless major version upgrades. Major versions can no longer make dramatic jumps (like Drupal 8’s move to OOP or the Twig templating system) which necessitate major code rewrites, but instead make small, reasonable changes between minor versions.

With the new approach to versioning developers get a variety of automated tools that ease the shift between minor and major versions. Deprecation checking means developers get notices in their code editors when parts of the existing codebase have been marked as deprecated, i.e., queued for change or removal in an upcoming major version. Automated tools like Upgrade Status or Drupal Rector and its Drupal front-end Upgrade Rector can provide detailed upgrade status information and even automatically update code between major versions. All in all, upgrade paths are looking easier than ever.

A wider foundation: Sustainability through community (and Symfony)

Building Drupal on top of Symfony means even further specialization on the Drupal end. The new Drupal versions use Symfony for a host of standard web application tasks — things like form validation, data serialization, data storage and retrieval, content translation, templating, easy and human-readable configuration management with YAML — the list goes on. Building on top of Symfony lets Drupal developers build closer to the consumer level, i.e., build the media libraries, authoring experiences, layout managers, etc that really matter to users.

Drupal’s reliance on Symfony — a robust and mature web application framework with more than 600,000 registered developers — also translates to greater sustainability through a larger active community. Besides adding Symfony’s 600K developers to Drupal’s roughly 1 million, the move to a modern architecture and more collaborative versioning system makes Drupal more attractive to developers on the leading edge of their disciplines. That fact alone stands to benefit the Drupal community through new, top-tier talent driving further innovation.

Regular new stuff: Incremental feature releases

Drupal 9 Symfony 5

With Drupal’s new versioning cycle comes another benefit: major new features in minor version core releases. As Drupal 8 churns through minor releases (the second place in the three place version number, e.g. “y” in x.y.z) it continues to add brand new features to core. Unlike previous major Drupal versions, these aren’t just bug fixes and security upgrades. Game changing modules like JSON API, Media, and Layout Builder were all added to Drupal 8 in minor version releases — and more are in the works.

Drupal 9 Symfony Framework Classes

What does this mean for end users? A greater commitment to standardized features that meet primary needs (like media and layout management, for example) and a bigger pool of developers making sure those features are updated, stable, and compatible.

Drupal 9 symfony 5Drupal 9 symfony framework classesDrupal 9 symfony framework classes

Drupal 9 Symfony

I just finished one of my first Drupal 8/9 upgrades yesterday for a small searchable database of computer science tips & tricks run by a college out of Claremont, California. Admittedly it was a pretty simple site, but the upgrade took me just two hours. Wow.

Drupal 9 Symfony Version

Aten will be working on a variety of Drupal 8 to Drupal 9 upgrades in the coming months, but the landscape is almost unrecognizable compared to our Drupal 7 to Drupal 8 efforts. For us, for the rest of the Drupal world, and for our clients, that is real good news.