Alexander Schranz
Core Developer – Sulu GmbH
Core developer and support king. So dedicated to his work that we couldn't find a hobby to mention.

Sulu Release 2.1.9 & 2.2.5

We are happy to announce that we recently released Sulu 2.1.9 and Sulu 2.2.5.

Alongside several small bug fixes, the releases contain some long-awaited improvements, which I will briefly describe in the following sections.

PHP 8 support has landed 🎉🎉🎉

As stated in our last newsletter, besides launching our partner program, we focused on bringing full PHP 8 support to the Sulu content management system.

We merged the final pull requests to establish PHP 8 support a few days ago. With this release of the new 2.x versions we are happy to announce that the most up-voted issue is now closed! You can use PHP 8 in your projects.

If you look at our PHP 8 Roadmap, you will notice that most of the work towards bringing PHP 8 support to Sulu consisted of creating pull requests to other open source projects we are using. We are always happy to give something back to the libraries we use and push the PHP ecosystem forward.

On this occasion, I want to thank David Buchmann in particular. He reviewed a lot of those pull requests. He maintains a lot of libraries and makes great open source contributions to Symfony and other libraries. We also want to thank all the other maintainers and contributors of the libraries we use for their work on PHP 8 compatibility.

To test PHP 8 support in production, we already updated our own website to PHP 8. I want to mention two things we encountered that could be important if you want to upgrade your Sulu project to PHP 8: 

After reading this, you might wonder about PHP 8 compatibility for Sulu 1.6. Unfortunately, we will not be able to provide PHP 8 support for Sulu 1.6 because the dependency tree of the 1.6 version contains a lot of libraries that are not (and likely never will) be compatible with the new PHP version. If you were not convinced about upgrading yet, this might be a good argument to upgrade your Sulu 1.6 Project to the shiny and fast administration interface of Sulu 2.

Display custom error messages

Another highly upvoted issue on our repository concerned the ability to display custom error messages from PHP in the the Sulu administration interface when a request failed. We are happy that we could finally resolve the issue by implementing the rfc7807 error messages format

To improve the user experience of the existing features, we utilized the new functionality to display more specific error messages in various cases. For example, Sulu will now display a specific error message when a user uploads a file that is too big or does not match a configured file type.

      "code": 1234,
      "message": "Bad Request",
      "title": "My Custom error message"
Example error response which is displayed in the Sulu UI

Index selected Snippets, Categories and Tags

Besides PHP 8 support, our team also improved the search index implementation. It is now possible to index the content of selected snippets in pages. Additionally, the names and titles of selected tags and categories are now indexed and will be included in the search too.

Improve performance of sulu_content_load

The sulu_content_load twig extension can be used to load the data of a page inside of a Twig template. Before this release, the extension loaded the whole page and resolved all of its content types. This is an expensive operation and it led to performance issues in a lot of projects. In the new releases, the Twig extension provides a parameter to specify which properties of the page should be resolved. This drastically improves performance when loading data of another page because only the relevant properties are loaded and resolved.

{% set page = sulu_content_load(pageUuid, ['title']) %}
{% set page = sulu_content_load(pageUuid, {'title': 'title', 'excerptTitle': 'excerpt.title'}) %}
Define which properties should be resolved by sulu_content_load

Improve teaser provider for pages

In older versions, the teaser provider for pages loaded the data of the selected pages from the search index instead of using the PHPCR persistence layer directly. In the past, this behaviour led to multiple issues that were caused by out-of-sync search indexes, missing permissions information in the search index, or bad search index performance. Additionally, the behaviour made it harder to pass additional information from the teaser provider in a project. 

To solve these issues, we decided to load the data from PHPCR directly. This also allowed us to fully support the page permission feature that was introduced in Sulu 2.2 in the teaser provider. 

Upgrading your project

We encourage you to have a look at our Upgrading Sulu 2.x documentation when upgrading your project. The documentation provides a step-by-step guide to upgrading Sulu in your projects. Feel free to contact us if you have any questions or problems during the upgrade process.

What is coming next?

We will focus on releasing PHP 8 compatible versions of our bundles in the coming weeks. We also hope to release the first 2.x versions of the SuluAutomationBundle and SuluRedirectBundle soon, and are working on improving the usability of Sulu and providing a basic event system in the next minor version.

We are always happy to receive your feedback about newly released features and bug fixes. Feel free to create an issue or a discussion on Github about bugs and feature requests. You can also contact us via our Slack channel anytime.