Is PHP Dead in 2022?

Is PHP Dead in 2022?

Or "Can I make lots of money with PHP?"

·

5 min read

tldr; No, PHP is not dead in 2022. Thanks for reading.

Today PHP celebrates its 27th birthday and "Is PHP dead?" or "Is PHP used anymore" is a question that many fans of competing languages ask about PHP. Perhaps that's because they have seen a graph that looks something like this:

TIOBE-Index-November-2020-The-most-popular-programming-languages-and-their-trends.png

The teal line represents PHP's usage. It has done down in share over the past decade, since the times when PHP was one of the most popular freely available programming languages for backend web development. But that's mainly because there are more languages to choose from now. Node.js, for instance, came along around 2010, giving people an option to use the same language on the backend that they use on the frontend, which has proven fairly popular. Python has also increased in popularity.

As many people learned PHP as one of their first web development languages 10-20 years ago because it is easy to learn or was the go-to web programming language when they first broke into web development they may remember the bad code they wrote when getting started.

But PHP still has a lot of advantages as a language and an ecosystem. And also, PHP is under active development, with lots of smart and passionate people working on the language and related tooling. Consequently, PHP has matured and evolved considerably over the past several years, becoming a much more robust language than its reputation from years ago may suggest.

It's kind of an in-joke in PHP programming circles, posting photos of our fancy houses and cars that suggest "Don't tell people about PHP so we can make all the money from it ourselves." Taylor Otwell, the creator of the excellent Laravel framework for PHP just posted a photo of his new ride in front of his beautiful new house.

lambo.jpg

It's fair to say that Laravel, and products built on it are in good shape. However this makes you feel, it helps drive home the point: If your objective is to learn a programming language that is in demand and has a lot of potential for giving you a good career, you can't go wrong with PHP.

If you are a career web developer, at some point you are likely to end up "falling into" a job where PHP is used in some legacy systems or there is a history of developing applications with it. But why would you actively choose to use PHP on a new, greenfield project? There are a number of reasons.

  1. PHP is easy to learn and use. It has a clear and expressive syntax, low-overhead, and you can use as much or as little of it as you like. It doesn't need to be compiled, and you don't necessarily have to use classes or object-oriented design if that isn't warranted. It's also easy to get started and learn as you go. Compare this with another extremely popular language like Java, which is still also very widely used and is actively taught in computer science courses. It's like night and day for how easy PHP is to use compared to Java.

  2. There are excellent developer tools that work with PHP out of the box. VS Code is available for free and works brilliantly with PHP code. Or if you are a student or are willing to pay for your tooling, JetBrains' PHP Storm is wicked smart, offering automated refactoring, integrated testing, smart autocompletion and automatic fixes for common errors. Additionally, testing tools like PHPUnit, Pest, and static analysis tools like PHPStan allow you to thorough test and check your code to ensure that everything is going to work properly. This makes it possible to write very robust applications.

  3. PHP has an awesome dependency manager. Composer along with make it very easy to install and maintain all kinds of packages to add pre-existing functionality with almost no effort. There is also a huge library of PHP packages available on Packagist.

logo-composer-transparent.png

  1. There are excellent frameworks for PHP to provide structure and built-in tooling for larger PHP projects. The one I'm most familiar with is Laravel, which makes it super simple to make complex, database driven applications using nice routing, a powerful and simple ORM for data access, good security, and tons of helpers and tools. There are also other frameworks like Symfony, Yii, CakePHP which are popular. Using a framework like this gives you structure and conventions to make your code more maintainable, and saves you from a lot of "reinventing the wheel".

laravel-logo-3528298770.png

  1. WordPress is made on PHP. Wordpress is likelythe single most popular web application on the internet by a large margin, and tons of people get started in blogging and/or web development from WordPress. By learning PHP you can work with and enhance WordPress, giving you a highly sought after area of expertise.

  2. Last but not least, PHP has an excellent community around it with some wicked smart developers creating packages and helping each other learn. If you want to learn about Laravel and adjacent technologies, Jeffrey Way has created Laracasts with lots of well-made tutorials that will get you up to speed quickly. Freek Van der Herten and Spatie have made all manner of packages that add a ton of amazing functionality to PHP so you don't have to create commonly used things yourself.

Adopting PHP for a project gives you all of this and more. And most of this doesn't even cost anything - you can learn and use PHP for free, download VS Code, pull in Laravel, and build yourself a sophisticated website, and run it on a web server without paying a cent so this is a great way to get started as a serious web developer.

Thanks for reading! If you enjoyed this article, follow me on Twitter to learn more about PHP and web development!