Senior full stack developer and CTO at Ideamotive.
PHP is one of the oldest open-source programming languages. Developed over 26 years ago, PHP has evolved from a simple web page builder to become a popular scripting language for web applications and APIs.
With each version release comes extensive functionalities and features that simplify and speed up software development processes. In this article, we dig deeper into the state of PHP in 2021, how it has changed since last year, and its future development.
Table of contents:
One common misconception is that PHP is outdated. Some programmers see it as a dying language, which could not be further from the truth.
PHP remains one of the most popular programming languages in 2021. W3Techs data shows that as of January 1st, 79.1% of websites with a known server-side programming language use PHP. This figure is a slight but notable increase from the December 2020 usage statistics of 79%.
By June 1, 2021, about 79.2% of websites now use PHP, growing even further than its usage at the beginning of the year.
This may be due to the introduction of additional functionalities in the most recent version— PHP 8— which was released late 2020. This version introduced improvements and new features like:
JIT improves PHP execution speed. However, this performance improvement is more substantial in mathematical codes rather than web application codes. The feature also opens up the possibility of moving codes from C to PHP. JIT compiler is enabled through the OPcache extension.
This feature is an improvement on the previous version's Weak References. Weak Maps hold a collection of references that allows objects to be garbage-collected if there are further references. It improves performance and memory management.
Before PHP 8.0, only two union types were supported. They are the nullable unions using the ?Type syntax, and the array or Traversable union using the special iterable type. In this latest version, arbitrary union types are supported in function signatures and are defined using the T1|T2|... syntax. The advantages of this feature include:
In the previous version 7.4, metadata can only be added through doc-comments. The PHP 8 introduced attributes that enable developers to add metadata to declarations in a structured way without the need to parse docblocks. Attributes are added before the declarations (functions, classes, constants, properties, methods, and parameters) they apply to. They can be declared before or after a docblock comment.
Other improvements in PHP 8.0 include:
There have been some updates on PHP 8.0 this year. These are 8.0.1, 8.0.2, 8.0.3, 8.0.4(unreleased), 8.0.5, 8.0.6, and 8.0.7 released between January and June, 2021. We will discuss these version updates later on in the article.
There are up to 38 PHP frameworks available. Here are some of the popular frameworks in 2021:
Laravel is a free, open-source PHP web framework with robust features and applications that simplify web development. It has a Model-View-Controller (MVC) based architecture and features like Eloquent ORM and artisan tools that enable web developers to automate repetitive coding tasks and make the development process faster. Other functions include built-in authentication, easy integration with popular email services, Blade templating engine, and many more.
Latest stable version: 8.16.1
Companies using Laravel: MasterCard, 9GAG, BitPanda, and Razorpay among others
Symfony is a set of reusable PHP components and a web framework for web application development, APIs, and microservices. It is notable for its easy integration and features that; reduce repetitive tasks, eliminate strict dependencies, and improve adaptability. Symfony allows you to use full-stack customization to develop a complex application with various functionalities. Also, you can use the brick-by-brick framework to build a product using certain functionalities or install a specific brick for your desired functionality.
Launched: October 2005
Latest stable version: 5.2.6 released on March 21, 2021
Companies using Symfony: Typeform, Statista, Stack, Postclick, etc.
CodeIgniter allows developers to build dynamic apps using PHP. Although CodeIgniter supports the MVC pattern, it is optional, thereby making this framework non-restrictive. Although it has fewer features than Laravel, it is powerful and is well-known for its lightweight, easier installation, and speed. Some CodeIgniter features include security and XSS filtering, email integrations, flexible URI Routing, data encryption, Query Builder database support, and more.
Launched: February 2006
Latest stable version: 4.1.1
Companies using CodeIgniter: SocialDog, Buffer, Accenture, Birdview, among others
Yii—an acronym for "Yes It Is"—is a PHP framework that follows the MVC architecture pattern and has robust features that accelerate web development. It supports DRY (Don't Repeat Yourself) design to eliminate redundancies and improve code readability. Yii has a web-based code generator called Gii that developers can use to generate models, controllers, forms, modules, extensions, and CRUD. This framework supports layered caching schemes such as data, page, HTTP, and fragment caching to improve the performance of web applications. Other features are unit and functionality testing, security measures, error handling and logging, easy integration with other frameworks, and more.
Launched: December 2008
Latest stable version: 2.0.42 released in May 2021
Companies using Yii: General, Medicus AI, Fujitsu, Web stack, etc.
Just like its name suggests, Slim is a PHP microframework for developing powerful, small-scale web applications. It is lightweight, supports all HTTP methods (GET, POST, PUT, DELETE), and has Url routing and matching features. This makes it one of the best frameworks for building a REST API. Some other functionalities include dependency injection, middleware, error handling, and PSR-7 support.
Launched: September 2010
Latest stable version: 4.8.0 released in May 2021
Companies using Slim: PathMotion, Directus, HHey, Coderus, and more.
Phalcon is an MVC-based PHP framework implemented as a web server written in Zephir and C, making it faster than other PHP frameworks. This framework is loosely coupled and enables developers to use all or specific components in isolation depending on their project requirements. Some of its features and functionalities include dependency injection, low memory consumption, templating engine, and security features that prevent password hashing and CSRF.
Launched: November 2012
Latest stable version: 4.0.6 released in May 2020
Companies using Phalcon: Edureka, Cargo, Proshore, Rentger, and many more.
CakePHP is a free, open-source PHP framework that allows developers to build web applications rapidly. This framework supports the MVC pattern making it easier to build apps using fewer codes. It offers features like class inheritance, plugins, CRUD Scaffolding, built-in validation, auto-detect, templating engine, etc, that speed up development. It also has sophisticated security features that prevent SQL injection, cross-site scripting, cross-site request forgery, form tampering, etc.
Launched: April 2005
Latest stable version: 4.2.2 released in January 2021
Companies using CakePHP: Deloitte, Swat.io, SeatGeek, Walls.io, and many more
As we mentioned earlier, there have been some updates on the PHP 8 version in 2021. These updates are mostly minor tweaks and improvements on syntax and bugs. Here are some of the bug fixes in each version update according to the PHP changelog:
Released: January 7, 2021
Some fixed bugs:
Released: February 4, 2021
Some fixed bugs:
Released: March 4, 2021
Some fixed bugs:
Not released due to malicious commits in the PHP source code repository.
Released April 29, 2021
Some fixed bugs:
Released: May 6, 2021
Released: June 3, 2021
Some fixed bugs include:
See the PHP changelog for more bug fixes on each version release.
Also, read up on PHP vs. Java to find out the best choice for web development.
The recent PHP 8 version brought new major features like; the Just-in-time Compiler, Constructor Properties, and Named Parameters which opened up the language to new possibilities.
Currently, an incoming version 8.1 is in the works. This version will be released on November 25, 2021, according to the PHP Development Team's timeline. Here are some of the expected features in the PHP 8.1 version:
Also known as green threads, fibers in PHP 8.1 are a low-level mechanism that allows you to build interruptible functions. With this feature, you can resume and pause functions within your program in isolation. Although this proposed feature will not be purely asynchronous in this version, it opens up this possibility in future versions.
Enums assign names to a collection of constant values. Before this, PHP had no built-in enum type but instead relied on a basic SPL implementation. This addition offers a more structured way to show the status of objects. It will also generally reduce errors and make it easier to read programs.
PHP classes are compiled and cached separately and then linked at runtime on each request. The incoming Inheritance cache improvement eliminates this compilation overhead by linking a set of classes just once at first request and storing them in an Opcache shared memory.
Other notable features are:
Also, as we mentioned earlier, nearly 8 out of 10 websites with a known server-side scripting language use PHP in one form or another. This number may be higher when you consider undetected websites that may use PHP.
Generally, PHP is used for building web applications but is best suited for developing a WordPress website. This is because a substantial part of the WordPress core—including its themes and plugins—is written in PHP.
You don't need advanced knowledge of PHP to create simple WordPress sites. However, if you want to develop WordPress plugins and themes from scratch, or make advanced customizations and changes, using PHP gives you a better chance at creating a robust application.
PHP's extensive features coupled with the growing demand for the user-friendly WordPress CMS make it a good choice for web development in 2021.
The current state of PHP shows that it is far from dead or dying. Instead, yearly releases usher in features that enable developers to build robust business-critical web applications and APIs for companies.
Looking for PHP developers? Contact us today. We have a vast pool of PHP and other developers in our network. We will make sure to connect you with talents perfectly fitted for your industry and company culture.
Dawid is a full stack developer experienced in creating Ruby on Rails and React Native apps from naught to implementation. Technological superhero, delivering amazing solutions for our clients and helping them grow.View all author posts
Our vetted experts are ready to join your team.Hire Web Developers
Robert Krajewski 11 min read
Dawid Karczewski 12 min read
Adam Bałazy 7 min read
Miłosz Kaczorowski 7 min read
Dawid Karczewski 6 min read
There are dozens of vetted PHP professionals in our talent network.