With the release of Joomla 3.8 a first compatibility layer for Joomla 4 was released. What does this layer contain? Why is such a layer needed? Questions like this will be answered in this post.
A big change in Joomla 4 are namespaces, a feature which exists since PHP 5.3.0, released in 2009. The whole PHP community has fully adapted to it and Joomla doesn’t want to fall behind.
In Joomla 4.0, the core architecture will be supporting and largely using namespaced PHP code. This applies for the core libraries and extensions.
Why a migration layer
We have a promise that a Joomla 3 extension will run on Joomla 4 and a namespaced Joomla 4 extension on Joomla 3.9. To achieve that, we decided to go step by step to reduce the risk of bugs and to give the extension developers enough time for adaption. The first step was to namespace the libraries folder in Joomla 3.8. This means that classes like
JForm now have the class name
\Joomla\CMS\Form\Form. To keep backward compatibility, the old class names do still work. That’s the migration layer we were talking about.
Classes which still do exist in the folders
/libraries/legacy are mostly deprecated or removed in Joomla 4. There is one exception, the filesystem package. We didn’t have enough time to convert it for the 3.8.0 release. It will be done then in 3.9.
What should I do with my new extension?
If you plan to do a new extension for Joomla 3, then you still need to do it the old way. You can use the namespaced libraries classes, but the extension, primarily the component, still needs