PoPHPularity

Is it decreasing and what to do about it?

2023-03-01

My friend Florian Bauer recently posted an article saying that PHP needs a rebranding, and he suggests to rename it to HypeScript. There was a lot of response to this. Here's my two cents on that subject.

Does PHP's popularity actually decrease?

One reaction to the article from Povilas Korop (creator of laraveldaily) was, that in his opinion, PHP is doing just fine.

The author says that PHP is great but needs "rebranding".

I disagree that there is a problem, PHP is doing great :)

Original tweet

OK, so first let's try to research if PHP actually has a problem. I tried to analyse different available resources about the popularity of programming languages. One important thing here: it's about the popularity among developers, not about the overall usage for websites. When it comes to usage we know, that a huge portion of the web runs on PHP, mostly due to wordpress. So, here's what I found about the popularity:

Stackoverflow Developer Survey 2022

I think one of the best sources about this topic is the Stackoverflow Developer Survey. Last year's edition is based on the answers from 73,268 developers from 180 countries, so it should be pretty representative.

So, to see if popularity is decreasing, I copied the numbers about PHP usage, from all surveys since 2013:

AllOnly Professional
202220.87%21.42%
202121.98%22.54%
202026.2%25.8%
201926.4%25.8%
201830.7%31.4%
201727.9%27.2%
201625.9%
201529.7%
201428.9%
201334.8%
Links to all surveys
PHP's history in the Stackoverflow Developer Survey since 2013
History of PHP usage among Developers according to the Stackoverflow Developer Survey

So, it shows a slow, but steady downwards trend (except for 2017 and 2018). Especially recently in 2021 and 2022, the usage dropped significantly, to around 21, 22 percent (for the first time below 25 percent).

For 2022, Stackoverflow also shows the numbers for professional developers and people learning to code separately. In 2022, 21,42% of professional developers used PHP, but only 18.82% of the learners. In contrast to this, languages that seem to be more popular among learners are: Python (43,51% professionals, 58,38% learners), C++ (20,17% professionals, 34,69% learners), as well as C (16,7% professionals, 31,94% learners) and Java (33.4% professionals, 38.67% learners). Btw. one thing that I didn't expect is that Javascript is used more by professionals (67,9% professionals, 59,79% learners). To me, the languages popular among learners, seem to correlate a lot with languages taught at universities. When looking at the overall numbers for those languages, only Python really became more popular overall.

Further, PHP is a language made primarily for web development, so it doesn't make a lot of sense to compare it with any language. Fortunately, Stackoverflow in recent years also asks about usage of the most popular web frameworks in the survey. Here are the numbers for some web application frameworks:

LaravelSymfonyDjangoExpressASP.NET CoreASP.NETFlaskRuby on Rails
201813%27.2%
201910.5%13%19.7%23.7%26.3%8.2%
202011.1%4.4%14.2%21.2%19.1%21.9%14.2%7%
202110.12%3.85%14.99%23.8%18.1%15.74%16.14%7.04%
20229.45%3.58%14.65%22.99%18.59%14.9%14.64%5.83%
Usage of different web application frameworks according to the Stackoverflow Developer Survey since 2018/19

Unfortunately, it's just a few years, but we can see a few things. Express (Node.js) is used a lot, and Node.js overall will even be used a lot more. Because for example, since 2022 the survey also lists Next.js already at 13.93%. Also, Python is pretty big with Django and Flask. Laravel and Symfony together are used only around 13% in 2022. ASP.NET (Core) seems to also be used a lot more than PHP even though it seems that its usage dropped a lot from 2018 to 2021. So, looking at those numbers it looks like it's pretty clear that PHP is by far not the most popular choice for web development.

Various Sources about the Global Software Developer Population

There is a lot of different sources for numbers about the global software developer population. I think the main organizations doing the research, are SlashData behind the Developer Nation Pulse report and Evans Data Corporation with their Global Developer Population and Demographic Study.

According to this article by Grid Dynamics, citing data from different sources, there were 5 million PHP developers in 2013, 5.5 million in 2018 and 6.1 million in 2019. And according to this article citing SlashData, there were 6.3 million in Q1 2021. So, in total the number of PHP developers is growing. Slowly but steady.

Let's have a look at the total number of software developers in that timespan. According to this article by /slash which is citing the Developer Nation Pulse report, the total global developer population was 18.2 million in 2013 and 26.8 million in 2021. And this PDF by SlashData from 2019, linked in the Grid Dynamics article, says there were 18.9 million in Q4 2018 and there will probably be between 21 and 23 million by the end of 2019.

So, with those numbers it looks like this:

TotalPHP
202126.86.3
2020
20196.1
201818.95.5
2017
2016
2015
2014
201318.25.0
History of the global Developer Population overall vs. PHP
History of global developer population overall vs. PHP

So, despite that the total PHP developer community is still growing a bit, in recent years it's growing a lot less than the total developer population. It looks like from 2018 on there's pretty much an explosion of the total number of software engineers. And this is expected to go on. The predictions are, that we'll reach 45 million developers in 2030. One could also argue that maybe the growth in developer population is not that much in the field of web development. I don't know any numbers about this, but I doubt that web development makes for such a small part of new developers.

PYPL and TIOBE Index

There's also the PYPL and TIOBE indexes, which both show a rather similar picture.

PHP's history according to the PYPL and TIOBE indexes

Disclaimer: I'm not too sure about the quality of the TIOBE index. Quote from tiobe.com:

The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings.

Summary

All this sources may somehow be criticised and there are also some positive things, like:

  • Laravel being one of the most popular web application frameworks overall, when it comes to github stars.
  • Packagist stats show that package installs are growing constantly (maybe also due to growing number of packages, but for example also laravel installs are growing constantly).
  • It's still a very big community with every fifth developer worldwide using PHP, and it's still in the top 10 in all the listings.

So as we, in the community all know, it's probably not dying any time soon. But after all there's a lot of evidence for a decreasing overall popularity of PHP, especially in recent years. So maybe it wouldn't hurt if we could do something about its reputation and attract more beginners.

Why is its Popularity decreasing?

Disclaimer: this is definitely all opinionated. It's not certain that its popularity is actually decreasing and if it is, I can only guess what could be the reasons for it. That being said, before trying to find an answer to why it is decreasing, I first want to give my opinion on:

Back in 1994, Rasmus Lerdorf wasn't trying to create a solid programming language. He wanted to have something like a template engine. He wanted to add little code snippets inside HTML documents to add some dynamic content instead of printing HTML from a Perl program. So, by the way, the origins of PHP and Javascript have quite a lot in common: initially they both were thought to be little script blocks inside HTML documents to add some very simple dynamic content.

Besides that, Rasmus also focused on the ecosystem early on and made sure it works nicely together with Linux, Apache and MySQL (Mini SQL). You may have heard of LAMP ;). It was made for web development and at that time nothing compared to it. Soon basically all hosting providers pre-installed PHP everywhere and popularity exploded.

To put it in one simple statement, I'd say the main reason it became popular in the first place is the low entry barrier. With shared hosting accounts you got everything pre-installed and for local development soon there was also WAMP/MAMP. And further, as someone who already knew HTML, it was a lot easier to make something work with PHP than it was with other languages available at that time, like Perl. There may be also various other reasons it became popular, but in my opinion, this is the main one.

And I'd argue that it was pretty much the same main reason for Javascript to become popular. To get started coding JS you can just create a file and open it in the browser. With the release of Node.js, JS usage exploded, as it enabled people to code frontend and backend in the same, easy to learn, language. That language that you'll probably need to learn anyway when working in web development.

What happened since then?

Since those days a lot has changed, so let's have a look if those things from the early days, that caused its popularity, still apply.

Easy hosting and local setup (LAMP/WAMP/MAMP)
The infrastructure ecosystem changed a lot since then. Apache isn't the only web server anymore. In fact nginx has already overtaken it in usage. There are a lot of other popular databases nowadays, like PostgreSQL for example. And also we often use other services like Redis, RMQ or Meilisearch. So for a large part we've moved away from the classic LAMP stack. You can still use it, but nowadays, I actually wouldn't really recommend it anymore. Besides that there's a myriad of options what you could use and there are a lot of attempts to make it as simple as possible again, like laravel Valet/Sail/Homestead for local and forge for production (+ deployment). But having so many options also makes it difficult for beginners.

Learning Curve
The web grew, and we started seeing more sophisticated web applications instead of just simple websites. So, people also used PHP in more complex ways. We separated frontend and backend code. With PHP 5, the foundation for OOP was improved a lot, and it became the default. People built MVC frameworks and a lot of helping libraries. So, getting started got more complex and there is a lot more to learn nowadays.

But, in both cases it's pretty much the same for its competitors (Javascript, Python,...) too. Everything got more complex, but that's mainly due to the complex requirements of modern web apps. But the thing is: PHP isn't the de facto standard for web development anymore that it was end of the 90s and early 2000s. All languages/frameworks are having their advantages and disadvantages and all of them are putting in a lot of effort to improve.

What can we do about it?

I see a lot of people doing a lot for the language and its ecosystem every day. Without steps like the big improvements in PHP 7 and laravel, PHP could potentially already be irrelevant today. Here are some ideas (some even already in the process) what we could do, so it won't become irrelevant in the future.

Lower Entry Barrier

Installation
I believe it's important to try keeping the entry barrier as low as possible to attract beginners (or to not scare them off). A pain point for some people is the local installation of PHP and switching versions. On macOS most people install and update PHP via Homebrew. Overall that's actually pretty simple, but unfortunately sometimes it doesn't really work for people as you can read in this twitter thread for example. I also experienced some trouble with it in the past. A tool, that I haven't used yet, but looks very promising to me, is PHP Monitor. Unfortunately the README says you have to first install Laravel Valet which I'm not using. The website says you can also use it to switch versions, but as far as I can see this is only about already installed versions. I'd love to see this to work independently of valet and being capable of installing versions that aren't installed yet. Huge would be if it could even handle extensions. Really nice is also that it's displaying some of the most important config values and guides you to the config files on your system. So, keep up the great work Nico Verbruggen!
(UPDATE: Nico told that in an upcoming version it will work without Valet and the other suggestions from this article are already in the works. I'm really looking forward to that!)

I haven't used Windows in a long time, but I'm pretty sure the PHP installation experience for Windows users can also be improved a lot.

Debugging
Another pain point, not only for beginners, is debugging. A big step in the past to improve this was Xdebug by Derick Rethans. But in my opinion it's not really easy to install and handle for beginners. Another great step in this field is Ray by the legendary folks at Spatie. I think it would be huge for the community if it was a free open source tool, but that's probably asking too much 😅.

Documentation
On social media I'm reading a lot of criticism, as well as calls for help with the official PHP documentation website (php.net) from within the community. I believe this can also be a crucial aspect to attract beginners. Imagining I'd come to this page as a beginner today, I'd be pretty confused. No easy getting started tutorial, no overview of the ecosystem (composer, frameworks,...). And when I get to the documentation overview, there's a huge table of contents where I won't know what I'll actually need to learn. Further a lot of examples today seem a little outdated.
In contrast to php.net, take a look at python.org. Isn't it way better?
From time to time I see people trying a little redesign, like tweeted by Tim MacDonald recently. A redesign wouldn't hurt, but I think way more important would be to rework the content and structure.
Florian (yes, the guy with the HypeScript article) called for people to join a coding session last monday, with the goal to start building a better PHP website. The site is work in progress but can already be found at better-php.net.
Another great example that good documentation is key, is again laravel. I'm pretty sure it wouldn't be where it is, without its great documentation.So, I hope we'll soon see bigger improvements in this area.

Language Evolution

By the end of 2022, PHP 7.4 entered end of life, which means no PHP 7 version will get any updates (not even security) any longer. There was quite some talk about this, because PHP 8 was only 2 years old at that time and the end of PHP 5 and switch to PHP 7, was only 3 years ago. You can read about some PHP user's frustration in this article. Having worked in a company with a pretty large PHP codebase that was started around 2010 and includes a lot of apps/projects, packages and microservice REST APIs, I see the point that major upgrades can be very heavy to lift for bigger companies. But larger companies in my opinion are an incredibly important factor for the community, because they'll provide a lot of jobs and a bigger number of available jobs attracts beginners to learn the language.

So, should we just go on without introducing any breaking changes to the language? Actually there is a language that is basically not introducing any changes that are breaking backwards compatibility: Javascript. For ECMAScript 6 it was decided to avoid versioning. When thinking about how the web works, I guess you can imagine why breaking changes aren't really an option for JS. You can do a lot with non-breaking changes, but the pressure of not being able to have breaking changes and the language being very popular at the same time, inevitably lead to TypeScript.

HypeScript / P++

When I read Florian's article, his naming idea "HypeScript" immediately reminded me of TypeScript. And that in combination with PHP, reminded me of an idea that I've heard in different forms before:

  • Brent Roose's idea in this video of a language that compiles to PHP, just like TypeScript, to make generics possible in PHP. There's even already efforts in this direction like ARA and PXP.
  • The idea of P++, summarized by Nikita Popov in this proposal.

So Florian's idea isn't completely new and crazy. But Nikita also already pointed out the downsides of this idea in his proposal. I'd summarize it with: basically it's just like another new major version that introduces very significant breaking changes along with a rebranding. Both ideas (by Brent and Nikita) would be new languages that'd exist alongside PHP. Nikita also mentioned that:

...this needs a concerted multi-year effort from a larger development team than we have right now.

I'm not sure, maybe this already changed a bit with the introduction of the PHP Foundation, which leads me to:

Sponsoring

Development of the PHP language depended on the free work by volunteers until the PHP Foundation was founded end of 2021. The Foundation, at the time I'm writing this article, already has 162 organizational and 1439 individual sponsors. With this money they're paying Core Developers (currently 6) to ensure long-term sustainability of the PHP language development. So if you appreciate the big improvements that have already been made in PHP 7 and 8 and want to see more of this in the future, consider donating some money. Not only to the Foundation but also to the maintainers of your favourite PHP libraries via github sponsors.

Education / Universities

As I am a self-taught developer and haven't been to a university, I actually don't know, but I heard, that PHP mostly is not taught at universities. I googled and found some university websites telling that they actually do teach it, but I believe it's not the majority. I guess one reason is probably, that web development is only one of many fields and therefor other languages are more suitable for education. Anyway it would be great for the community if PHP would be taught in education.

Community

An important question when considering to use a technology in a company is: is there enough resources, documentation and an active community where we can find help in case we get stuck?
And as already mentioned before: companies using PHP provide jobs => available jobs are making people learn the language => community grows.

So if you like PHP and want to give back, there are a lot of ways to do so:

  • Contribute to open source projects
  • Be active on social media (twitter, mastodon,...)
  • Blog/Stream
  • Answer questions on Stack Overflow
  • Attend, speak at or even organize meetups and conferences
  • Correct people who are claiming that PHP is bad, for reasons that were maybe true for versions 20 years ago, but really aren't valid at all anymore 😅
  • ...

Conclusion (TL;DR)

We can't say for certain that PHP's popularity is decreasing but there's a lot of evidence that it is.

I personally don't believe there's one simple lever that we can pull to improve PHP's reputation/popularity. I think all of the above need to be pursued and partially people are already working on them. To repeat, I think the most important ones are:

For the Folks developing the Language and important Tools in the Ecosystem:

  • Make it as easy as possible for beginners to get started: smooth installation, great documentation, easy debugging,...
  • Be really careful with breaking changes and give users (especially big companies) enough time to migrate their codebases to new major versions.

For the Rest of Us:

  • Get involved in the community and give back.
  • Sponsor the PHP foundation and your favourite open source maintainers.

I believe that PHP's bad reputation outside the PHP community is heavily delayed as the language improved a lot in the last decade (for example see this video by Brent Roose). And here and there I see signs that it slowly starts getting better already. In this article the author says:

I may get a lot of flaks for including PHP in this list of best programming languages for web development in 2023 but to be honest, PHP is one of the best programming languages when it comes to creating web applications.

In my opinion a very good example for the awareness, that for a pretty long time there is this bad reputation, that it actually doesn't deserve (anymore). I also remember a few people on social media saying things like: "After a decade I gave PHP another quick try and was surprised how good it actually is nowadays.". So, this may be biased, but I see the reputation recovering more in the coming years.

And of course it also shouldn't be a big competition. There are a lot of great languages and people shall use the right tool for the job. I just think it would be very sad if barely any beginners started learning the language, because of the bad reputation that it doesn't deserve.

More Sources: