PHP 8 support has landed 🎉🎉🎉
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:
- The widely used PHP extension Imagick does not have a PHP 8 compatible release yet. As a workaround, you can compile the extension by yourself or use another extension such as GD, or the more feature-rich VIPS adapter, to convert your images.
- The second problem we encountered is related to the doctrine/migrations package we use in our projects. The package does not yet support transaction when running the migrations because of a change in the PHP 8 MySql extension. As a workaround, it is possible disable the transaction for your migrations.
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.
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.
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.