Zend Framework and PHP 7.1

When we announced Zend Framework 3 last year, one of the changes was setting the minimum supported PHP version to 5.6. Our initial plan was to support 5.6 until it reaches end-of-life, which occurs 31 December 2018.

PHP 5.6, however, stopped receiving active support almost five months ago, on 19 Jan 2017. This means that it is no longer receiving bugfixes, only critical security fixes. As such, a number of contributors have been pushing for us to up our minimum supported version to support only actively supported PHP versions, which would mean only PHP 7 versions.

In addition to active support, there are other benefits to jumping to PHP 7, including:

  • Scalar type hints
  • Return type hints
  • Null coalescing operator
  • Spaceship operator
  • Anonymous classes
  • Potential for enabling strict type checking

Of course, PHP 7.0 ends active support at the end of this year, on 3 December 2017; moving to 7.0 means that we could anticipate further version bumps in a very short time frame.

PHP 7.1 adds more features and benefits over those in 7.0:

  • Void return types
  • Nullable types
  • "iterable" pseudo-type
  • Non-public class constants
  • Multi-catch exception handling
  • Support for keys in list()
  • Built-in asynchronous signal handling

Further, 7.1 has active support until 1 Dec 2018, giving us a reasonable time frame for supporting the version.

Our view is that the new features in PHP 7 will allow us to simplify our code dramatically, reduce bugs (primarily by increasing type safety), make our code more easily maintainable (less code required to check types; less repetitive code), provide stronger and more predictable interfaces to our users, and simultaneously provide users access to more and better language features.


In addition to evaluating PHP 5.6 support, we have also been evaluating our support of HipHop Virtual Machine (HHVM), the alternative PHP runtime maintained by Facebook.

We started running tests against HHVM around the time we released ZF 2, and, for quite some time, required tests to pass except in specific components that used extensions without equivalents in the HHVM ecosystem.

Since we started adopting PHP 5.6, and, in select cases, PHP 7, we've increasingly needed to mark HHVM test jobs as "allowing failure", due to usage of PHP language features that do not exist in HHVM, or incompatibilities in the HHVM runtime.

One initial "selling" feature of HHVM was its performance. However, at this time, PHP 7 competes favorably with HHVM, eliminating one large argument in favor of choosing it. PHP 7.1 also includes many features at the language level (e.g., scalar typehints, return type hints, nullable types, etc.) that many were choosing HHVM for.

Finally, we have found that HHVM usage is an incredibly small percentage of our user base. We have noted that other projects have found similarly, and feel now is the appropriate time to stop supporting HHVM.

Acknowledging the Problems

The biggest downside to adopting PHP 7 releases at this time is one of adoption. Many organizations lock projects to specific infrastructure, including PHP versions. Even with supported repositories such as the Remi RPM repository (for RHEL, CentOS, and Fedora) and Ondřej Debian repository (for Ubuntu and other Debian-based distributions), enterprises still want to pin to distribution-provided PHP versions, which are often literally years out-of-date.

Zend itself offers a supported PHP 7.1 stack via Zend Server, which can be a solution for many of these organizations.

Additionally, with the rise in usage of virtual machines and containers, many of these obstacles are gradually disappearing for organizations. When you can package the entire infrastructure stack, testing and deployment become more predictable, eliminating many of the issues traditionally associated with infrastructure changes. We feel this trend will only increase.

The Plan

As such, our plan is this:

  • We will start releasing new major versions of components that pin to PHP 7.1+, so we can take advantage of the latest language features.

  • We will no longer test against HHVM. Most of our components were failing against HHVM already, so this does not pose a BC break at this time.

  • We will continue providing security patches only to the last release branch supporting PHP 5.6 until PHP 5.6 reaches its end-of-life date. This allows us to minimize the amount of maintenance we need for supporting these versions, while still providing stable, secure releases for our PHP 5 users.

  • New components will pin to PHP 7.1+.

We announced most details of this previously on our newsletter, so some of this work has already begun; we welcome all assistance any of our readers and users can provide in this effort!

On a personal note, I still fondly remember the release of PHP 5; the organization I worked at adopted it fairly early, and I was very excited about the features then. PHP 7 has stoked similar enthusiasm for me, and I'm excited to see what we build for Zend Framework using it!

Save the date!

Want to learn more about Expressive and Zend Framework? What better location than ZendCon 2017! ZendCon will be hosted 23-26 October 2017 in Las Vegas, Nevada, USA. Visit the ZendCon website for more information.



© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.