The State of PHP – an insight into trends, challenges, and use
This article by Matthew Weier O’Phinney, Product Manager and Principal Engineer for Zend by Perforce Software, takes a look at the results from a recent survey about the PHP programming language. 865 PHP professionals from around the world were surveyed about language trends, challenges, usage, and the future.
PHP remains one of the world’s most popular programming languages. As recent research performed by Zend (part of Perforce Software), businesses are using it to build business-critical web applications and APIs. The survey also identified some other key trends, challenges, and future directions.
In late 2021, the survey drew responses from 865 PHP professionals worldwide, primarily developers (64%), but decision makers also made up around a quarter of respondents. Overall, the team and organisation size was well-distributed and representative of the industry as a whole.
Respondents were asked about their development priorities. The majority cited prioritising new features on current projects (46%), followed by 19% saying security was their number one requirement right now. Application performance was the top priority for 15% of respondents, while improving code quality was the highest priority for 14%. These responses reflect that while time-to-market and innovation are high on the agenda, ensuring that code is safe and robust is increasingly essential. Compliance is a requirement for approximately half of everyone surveyed.
A significant departure in PHP use
One of the biggest departures since last year’s State of PHP survey is that 81% are using PHP for services or APIs, nearly double 2021’s result. Internal business applications were second on the list with 59%, followed by CMS systems at 46%. These results show that PHP has moved from driving content management systems into driving business value and business systems, and is particularly suited for B2B APIs.
The survey also provided some insight into why organisations are choosing PHP. Respondents were asked what makes PHP valuable for new projects or refactoring old projects. Use of standards (for instance, PHP Standards Recommendations) was the runaway reason, with web server integrations following at 56%. This makes sense: it is far easier to set up PHP with a web server than any other language. Strict types and async capabilities tied for third place at 35% each. While async is not quite mainstream, it is clearly valued by many PHP users.
That strict types was quoted by a relatively high amount of people is interesting because historically, PHP has been a dynamically-typed language. Strict types were only added in PHP 7, but the data could indicate that strict types provide more confidence around code quality and build applications that are easier to maintain and more secure.
Respondents were also asked where they are developing with PHP, and almost half are still on-premise (48%). This number is likely even higher, as many responses indicated “self-hosted,” which would fit under the label of on-premise. So, on-premise still reigns, but there is a substantial shift towards the cloud. Amazon Web Services represents 40%, trailed by Digital Ocean with 17%, Google Cloud Platform with 14%, and Microsoft Azure with 13%.
For development methodologies, Agile led the way with 62% of respondents, followed by CI/CD with 48%. Third-most popular was test-driven development (TDD) with 36%.
With containerisation and orchestration two of the biggest trends in software development right now, it made sense to ask the PHP community about their plans. 77% intend to use containerisation technologies, increasing from 65% in 2021. Almost half of the 77% plan to use containerisation within 2022. A mere 23% have no plans for containerisation. When segmenting the survey results, larger organisations showed a higher rate of adoption of these technologies, reversing the trend of the general software ecosystem where enterprises and mid-sized organisations are slower to adopt.
As far as orchestration is concerned, close to two-thirds use — or plan to use — these technologies, with 34% responding yes (within a year) and 27% answering yes (with no timeframe). On the other hand, 38% indicate they are not using nor plan to use such technologies. When breaking down the data, larger organisations are generally further ahead in orchestration.
Respondents were asked which versions of PHP they use (often more than one) and their upgrade plans. According to almost two-thirds of those surveyed, the most widely used PHP version is 7.4. What is surprising is 44% responded with PHP 8.0, which may be a bit aspirational as it doesn’t reflect what we’re seeing reported elsewhere in the greater PHP ecosystem. 32% are still using PHP 5.5 or PHP 5.6. 80% of respondents plan a PHP version upgrade within the next year, and only 20% are abstaining from an upgrade.
The heavyweight WordPress accounts for 44% of PHP-based applications, followed by Drupal at 17% and WooCommerce coming in at 15% (no surprise since it is part of the WordPress ecosystem). More than 40% of respondents reported not using any of these PHP-based applications. This indicates that a vast amount of the PHP ecosystem is creating bespoke applications and APIs.
SEE ALSO: “The new life of PHP”
However, not everything in the PHP world is perfect, with developers quoting several challenges. For example, 40% dedicate 25% of their time on maintenance and bug fixes, a massive drain on capacity. Investing in CI/CD pipelines can help mitigate this effort so that developers can focus more of their time on creating new features.
When carrying out PHP upgrades, testing and refactoring together take up two-thirds of everyone’s time (37% and 36%, respectively), followed by infrastructure provisioning and planning at 11% each. In common with the broader development community, to achieve scale, address the complexity and improve speed, testing and deployment methodologies must become more sophisticated.
Fortunately, multiple resources and tools are available to help PHP users overcome these issues. Furthermore, the language will continue to evolve, and with PHP being used for business-critical web applications, APIs, and internal systems, it remains a sound choice for today and the future.