PHP 8: Features, Changes, and Improvements

Download PDF

Update from May 28, 2021.
PHP 8 is production ready now!

PHP 8 was recently released, with all technical details listed here. As a Product Owner planning to start a new website or API written on PHP, what does PHP 8 mean for you? What benefits can you realize by upgrading an existing project to PHP 8? To briefly summarize, you can achieve a performance boost by upgrading through JIT (Just in Time) compilation.

In addition, your development team will be able to utilize a range of improved language features that make PHP better for enterprise-level projects. Union types allow for the defining type validation, making the language closer to a strong typing approach. Note that this is an optional feature, allowing you to take advantage of both weaker and stronger typing depending on the situation in question.

PHP 8 offers many similar upgrades and improvements, but this article will focus more on the Product Owner’s point of view about what’s new in PHP 8.

History of PHP

Let’s walk through a brief overview of PHP’s recent history, which helps us understand its evolution over the years and how it came to introduce JIT compilation in version 8.

In the early days of PHP, its primary use was to simplify web application development. PHP functioned as a template engine that allowed a user to select data in a database and render it dynamically to HTML. PHP sought to avoid writing overly complicated projects in C/C++ and to lower the technical entry bar for web developers. Over time, PHP grew as a language, adding more features and eventually becoming more than a template engine.

By version 5, PHP had become a general-purpose web language with a huge community and a robust assortment of frameworks and libraries. Version 5 introduced powerful OOP support, allowing users to create structured, enterprise-level code written with the best SOLID principles. Newer versions of PHP introduced the concept of frameworks, the most popular of which (Laravel) being developed as an alternative to old-school CodeIgniter. Symfony-framework became a Java Spring enterprise framework of the PHP world, and PHP received tools like the package manager Composer and the unit-testing framework PHPUnit.

The next major version after PHP 5 was PHP 7 – Yes, they skipped PHP version 6. The core team chose not to introduce JIT-compilation, but made massive optimizations in the interpreter itself and managed to largely keep the language backward compatible (unlike the upgrade from Python 2 to Python 3).

PHP 7 introduced a significant performance boost, optimized RAM usage, and improved syntax, and was backward compatible with PHP 5 applications in most cases, with rare exceptions able to be brought into sync with PHP 7 within a reasonable timeframe.

Now, PHP 8 has introduced JIT-compilation along with numerous other PHP 8 breaking changes, a logical step for improving on version 7. The good news is that the PHP core team continued their approach of prioritizing backward compatibility, just as they did in moving from version 5 to version 7.

Preparing for PHP 8: What does it mean for your existing applications?

Should you upgrade your production servers with PHP 8 tomorrow? Probably not. First of all, you should confirm that everything is working with PHP version 7.4. If that’s the case, your development team should familiarize itself with the migration guide.

Note that some elements are deprecated and will not work after upgrading to version 8. Keep in mind too that issues can arise not just with your own code, but also with dependencies. It’s important to check whether your dependencies in composer.json support PHP 8. Additionally, you will need to upgrade your framework if you use one. Symfony framework 5.2 should already be compatible.

The same should be true for Laravel.

While you shouldn’t upgrade your production servers immediately, you should begin to allocate your development team(’s) toward researching the amount of time and effort it will take to eventually upgrade to version 8. This will include looking into refactoring code with outdated and depreciated functions and approaches within your legacy code.

Even after your team is able to fix everything in need of updating, you should be performing a full testing regression of your system, as refactoring can often result in new bugs even in a project with adequate auto-test coverage.

Can you upgrade production after full testing is done? Yes, this is possible. But it’s advisable to wait for the next minor update version, which will have fixes for unnoticed issues in the new major version.

Make sure to measure your performance with the old setup and compare it with your new performance after upgrading, seeing which setup is optimal for your project. In particular, you should check how enabling JIT will affect your application. It may or may not have a significant effect.

Although performance will not be affected in every case, JIT-compilation adds many opportunities for PHP in the future. JIT can enable potential use cases beyond the classic server-side web applications and may add more asynchronous programming features to PHP in future versions.

How to start a new PHP project

If you’re starting from scratch, you can begin with version 8. This reduces any costs associated with migrating from a previous version. While your team is working, new minor versions will be released, and you’ll be safe to move to production when ready.

New PHP 8 improvements will allow your team to write cleaner code, resulting in better performance from the start. And keep in mind that the more code your team writes in older versions of PHP, the more migrating you’ll need to do when you choose to upgrade to version 8.

The most significant impediment to using PHP 8 would be if you know that you’ll have some dependencies incompatible with version 8 at your release time. However, this may be a sign that you ought to be thinking about replacing those dependencies anyway.

PHP 8 is production ready now!

Update from May 28, 2021.

Developers weren’t able to use PHP 8 right away after its release because in most cases it should go along with PHP frameworks and popular open source libraries, and cannot be used as just pure PHP. At MobiDev, we use PHP in combination with Symfony or Laravel. So, PHP 8 wasn’t production ready without being properly supported in the frameworks and libraries.

Recently, MobiDev’s PHP team has tested using the latest stable versions of Laravel and Symfony with PHP 8.

We’ve tested Laravel 8.41 in combination with PHP 8.0.6 and it’s shown no major issues so far. Also we’ve tried Symfony 5.2 with PHP 8.0.6, and can say they work fine together. We tried not only the out of the box version, but also popular libraries like Doctrine, StofDoctrineExtensionsBundle, RedisBundle, EasyAdmin, etc. Some of these libraries had some issues with PHP 8, but the bugs have been fixed now.

So, we can confirm that PHP 8 is production ready in combination with popular frameworks and libraries and can be use for web application development!

Want to get in touch?

contact us

By submitting your email address you consent to our Privacy Policy. You can withdraw your consent at any time by sending a request to

Content Download PDF
Open Contents
Content Download PDF
How to secure web applications from commonly known vulnerabilities

How to Secure Web Applications From Vulnerabilities in 2023

Human resources technology trends

HR Technology Trends in 2023: Digitalization with a Human Touch

How Businesses Get Into the Metaverse

How Businesses Get Into the Metaverse: Discovering True Opportunities