All Articles

Why I left PHP community

Photo by Matt Botsford on Unsplash unsplash-logoMatt Botsford

If you want to hear that ’PHP is bad’, this is not the right place, although I can recommend some very strong opinionated fellas experts on that.

My background

I’m a PHP developer. Actively blogging and working with it every day for many years. I was around PHP since version 4 was still somewhat new. People were excited about having Oriented Object concepts to dwell over. People were even getting why eval() and passthru() are so dangerous. Code was messy with confusing standards. It was too easy to live the codebase unmaintainable.

Even though I don’t code in PHP for some years now, I kept up to date to its community so far. Some because few consulting jobs I do have to do with it, some because the language is evolving and trying to keep up with new paradigms and concepts of modern programming languages. Yesterday I unsubscribe for the last PHP newsletter, and I think it was a symbolic action. Now I would like to share the rationale behind this decision.

How that happened?

This was not a quick process. When I talk to my peers about this slow detachment, they all have somewhat likely guesses about my reasons:

  1. Because ‘it is bad’
  2. Because it is old
  3. Because it is slow

The ‘is bad’ argument always gets me. It is a unclear, obscure and ambiguous expression for an argument. What angle are you looking to say it? Performance? Constructions? Documentation? Community? Standards? I find hard to imagine that a technology that helped (and still helps) to shape the Web as we know today is a total garbage. How can you think every professional that have chosen it for the last twenty years made a terrible decision?

About being old, I like old things. They tend to be mature, have a strong background and vivid community. Python, PostgreSQL and Debian, things that I love, all have more than twenty years. They are ancient by today standards, and do not seem to be going away. The trick here is to evolve and keep up with new tendencies. More on this aspect later.

Well, because it is slow I won’t put it on a embedded software with restrict hardware. I’d have my doubts about Python, or even JavaScript, in this context. Know where PHP is intended to be, and you’ll see that in most cases it is fast enough. At least if you use it right.

Again, I’m not here defending PHP. That would not make sense with this title, right?

My real motivation

PHP newer versions have improvements, some of them in line with other modern languages. It is not only getting faster, but allows you to have typehints, dependency manager, Composer, standards and much more to do it in the right way. Frameworks like Laravel and Yii2 enforce some really nice patterns and help you to keep things clean. Many legacy design traces are getting behind. But they are still there, used by many.

The biggest problem with PHP is to move forward. The language is evolving. But what about the community?

And here lies the big issue. People on PHP community resist so badly to moving on to good standards. They even have a bad time upgrading versions.

PHP versions based on Composer usage data

From packagist

You can see people tend to use dead versions for years, knowing all the risks. Does it matter if maintainers are eager to support the language newest features if people are not willing to upgrade? Things tend to get better over the years, but one must be willing to wait. This isn’t even reliable data, since the statistics come from Composer. How many still does not use it to manage dependencies? While smart people are discussing about exciting new features, I still have to debate with people why they need to sanitize their user inputs and why eval() is dangerous.

An old argument here is “you can do it right if you know how to”. Or even “you can have bad code in any language”. The thing is, lots of people are writing ugly code in PHP. More then I see in other languages, like Python. Of course this is a matter of perspective, I do not know any quantitative metric to measure this. But my point here is not about proving you why I left PHP, but how I feel about its community and why I decided to get out. If you know better, you probably will figure out an exit too.

That might be a matter of strategy. Python make a somewhat hard outbreak with version 3. People were kind of stuck in version 2 for many years, but those who wanted to keep up had to migrate as fast as possible. Those who didn’t, felt abandoned. When something like that happened to PHP?

I feel sorry for people that put so much effort on making PHP a better language everyday. They are being slowed back by the huge, not so eager to evolve, user base they have. But things around PHP do not feel growing right now. Again, not because they’re not evolving the language, but people are not keeping up to it.

Again is it Wordpress fault?

People often accuse me of being a Wordpress hater. I’m not here to rant about it, but I can’t deny it is a good example why PHP have some hard time moving forward as an cohesive community. As their own page shows, right now 67% of the Wordpress instances are running with a PHP version with no support whatsoever!!

Wordpress PHP usage stats

Since December 2019, even version 7.2 have only security support. So you can face it like 1/5 of the instances are running a actively support PHP version. How can that be? Furthermore, I would guess many of those up to date instances are hosted on wordpress.com.

Conclusion

More than two years ago, Python had only 13% v2 users, that was actively maintained by that time. It still a lot, but PHP 5.6 and 7.0 is dead over a year (the first after many extensions) and still make by 30% of the share! And if you look only at Python 3, things are better. I won’t even bring the fact that upgrading from python v2 was harder than PHP 5.6 to 7.0.

If you’re a PHP developer and have a lot of active projects, I see no reason to abandon it right away. Are they maintainable? testable? You can keep up getting them better, and thinking about design changes, like API splits and microservices. You probably will see more benefit from it than from switching the language and starting from ground zero again. PHP is not going anywhere soon. If you are new, or are going to start something new, I emphatically discourage you about PHP. Not only because the reasons I put here, but also about reputation. Unfortunately PHP can stain you resume and if you’re a team or company, it will attract bad professionals. I’m telling you this after writing PHP7 many time on job openings, without much effect.

But I don’t want to be part of a community with so much dead weight on it. Of course you can write good software in any major language, but I am sure some strong open minded people around you would help. Even if I keep in touch with it through colleagues and consulting, I hope I don’t need to struggle with it again. But I do wish good luck for those who stay!