PHP minimum requirements for TYPO3 CMS 7
November 13, 2014
The next major version of TYPO3 CMS will be called 7 and will have PHP version 5.5 as its minimum PHP version. We consider this step vitally important to our new release strategy for several reasons.
For some this requirement change might seem a small change - but it has a larger impact in our eyes. A reason we want to share and inform everybody about our decision. So let's get to the details:
Why should we raise the minimum requirements?
The Technical Part
PHP 5.5 offers some features that make our and most importantly your live as integrators much easier. Let's dive a bit in the current Core structure:
By utilizing the new feature ::class we can make the creation of objects simpler, less error-prone and more intuitive. Right now you need to escape backslashes when you want to get a new object with GeneralUtility::makeInstance.
The current code looks like this:
$myObject = GeneralUtility::makeInstance(‘TYPO3\\CMS\\Core\\Whatever’);
This way has several drawbacks, like an IDE is not supporting with namespace auto completion, the generation of imports and last but not least.. double backslashes? Seriously?
Now PHP 5.5 offers a neat syntax that is really easy to implement: class.
The new code will now look like this:
$myObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Whatever::class);
Actually, because you would import your class by using use \TYPO3\CMS\Core\Whatever; first, your code would look more like this:
$myObject = GeneralUtility::makeInstance(Whatever::class);
The cool thing is that your IDE will check, whether the class you try to access actually exists, you don’t have double backslashes anymore… it’s just plain better - leading to faster and more efficient development.
Finally we get an option to make sure that we can cleanly shut down parts of TYPO3 even if an exception is thrown. By using “finally”, also introduced in PHP 5.5, we can shorten the amount of code while making the overall product more stable.
Apart from that there are some interesting features from PHP 5.4 like traits etc. that are still under consideration - which means that we still need to do the necessary testing in order to make the educated decision if and where to use these new features.
Apart from the pure technical point of view there are some other things to consider:
First off we took a look at how PHP 5.5 is adopted throughout the PHP ecosystem. Since it is quite new its adoption rate is rather low - But we need to look into the future - because we plan to release CMS 7 LTS in fall 2015.
Right now all major distributions offer the possibility to provision PHP 5.5 on a server. Ubuntu 14.04 LTS comes with PHP 5.5 out of the box, Redhat Enterprise Linux offers an official RPM package for PHP 5.5 as well (see https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/1/html/1.2_Release_Notes/chap-RHSCL.html), Debian’s upcoming release (jessie) will include PHP 5.6.
Apart from that new projects like Docker offer a great and easy way to provision PHP 5.5 onto any machine.
Last but not least we took a look at the tools a developer would use. There are turn-key-ready Vagrant Boxes available, 3rd party projects like MAMP (OSX) or XAMPP offer PHP 5.5 (and even PHP 5.6) - so you’re covered.
Our Platform Promise
Although this is all nice and such, we have to cover a more important topic than all of the above - our platform promise.
The CMS team promises that the minimum PHP requirements will not change during the lifetime of a LTS version of TYPO3 CMS - and we do not plan to change this.
What seems like a minor task at first turns out to be a 5-ton gorilla on our backs 3-4 years down the road. At the time of writing we have two LTS versions running in parallel: 4.5 and 6.2. Since 6.2 LTS uses PHP 5.3 as a minimum requirement, we are still bound to our promise we gave when releasing 4.5 LTS - supporting PHP 5.2.
So even today every single backport needs to be thoroughly tested on PHP 5.2, which is harder than you might imagine - we even needed to re-enable our testing servers support for PHP 5.2 which was disabled by default because PHP was at the end of its lifetime for too long :)
So if we would opt to stick to, let’s say PHP 5.4, our promise would be hard to keep by the day we release the LTS version of CMS7 because PHP 5.4 will have reached its end of life already (see wikipedia.org).
Taking all these points into account this is why we will have PHP 5.5 as the minimum PHP version for TYPO3 CMS7.