DEV Community

Cover image for So... Is this PHP's Redemption? 😳
Fabian Reinders
Fabian Reinders

Posted on • Updated on

So... Is this PHP's Redemption? 😳

Is PHP rising from the dead?

Unbelievable yet true... PHP is trending on social media.

Why is this unexpected?

Well... If you're a developer and you've been on the internet the last couple of years, you must have stumbled across at least one meme/article announcing PHP dead for good.

But why is that?

The rise and fall of PHP

The rise of PHP

It's the year 1994. A developer called Rasmus Lerdorf
creates a set of Common Gateway Interface (CGI) scripts, which he uses to maintain his (P)ersonal (H)ome(P)age.
PHP's name later evolved to something more fancy, of course 😅 - "PHP: Hypertext Preprocessor".

It quickly evolved into a full-fledged programming language and became one of the most popular languages for building web applications. 📈📈📈

PHP's early popularity was driven by its simplicity and ease of use, making it accessible to developers of all skill levels.

PHP's architecture

PHP's paradigm is unbelievably simple:

File based routing (in most cases)
The URL/path of a page is made up of the folders and .php files contained in them.

Server-Side-Rendering
The user makes a request to the server and the server generates the HTML for the page dynamically (with the ability of fetching data from a database, for instance, and rendering HTML for that data before sending the HTML back to the user).

PHP's arch-nemesis

However, PHP's dominance began to wane as new languages and frameworks emerged that were better suited for building modern and interactive web applications. ☹️

Front end frameworks such as React, Angular, and Vue.js provided developers with more powerful tools for building complex, interactive user interfaces. 📈📈

A lot of websites began adopting the Single Page Application approach of these frameworks where you don't have to reload the entire page all the time and instead only fetch data from the server and let your front end framework render the HTML for the page on the client side.

"PHP is dying"

As we can see on Google Trends, PHP's relevance is on the decline:

Google Trends Chart for PHP

However, according to W3Techs:

PHP is used by 77.5% of all the websites whose server-side programming language we know.

This means PHP still holds a market share like no one else.

So is PHP dying? No. PHP is here to stay for years if not decades to come.

However, its relevance has undeniably been on the decline for quite some time now.

So- Why is PHP trending then?

1. JavaScript frameworks

Even though JavaScript frameworks are probably the biggest reason for PHP's decline in terms of relevance, they are also the biggest reason everyone seems to be talking about PHP again right now.

JavaScript frameworks like React and Vue.js are awesome! But their client-side rendering approach has some drawbacks.

One of the biggest being that the entire page is rendered at runtime in the client's browser.

Not only does it result in more network requests and a longer time until the user can interact with the page (after it loaded up), it also hurts SEO (Search Engine Optimization).

That is because nobody knows how well search engines can run the client-side rendering logic and the initial HTML sent to the client (or web crawler) is just an empty HTML skeleton. 😕

This is why we see JavaScript frameworks like Next.js or Nuxt adopting the concept of Server-Side-Rendering and generally code executed on the server to hydrate pages.

Next.js even adopted a file-based routing system... Does all that sound familiar to you? 🤯

Next.js is also adopting React Server Components - Components entirely rendered on the server, even when updated.

And Next.js recently introduced the concept of "Server Actions" - Functions of code executed on the server and used, for instance, to query data from a database:

import { sql } from '@vercel/postgres';
import { redirect } from 'next/navigation';

async function create(formData: FormData) {
  'use server';
  const { rows } = await sql`
    INSERT INTO products (name)
    VALUES (${formData.get('name')})
  `;
  redirect(`/product/${rows[0].slug}`);
}


export default function Page() {
  return (
    <form action={create}>
      <input type="text" name="name" />
      <button type="submit">Submit</button>
    </form>
  );
}
Enter fullscreen mode Exit fullscreen mode

Source: https://vercel.com/changelog/vercel-postgres

This reminds people a lot of PHP and has caused a flood of memes and comparisons, making people talk about PHP again.

2. PHP 8

PHP, to many developers, is nothing more than a memory. In fact, what many developers remember when they think about PHP is PHP 5, released in 2004.

PHP 5 is ancient and had a lot of issues. However, because it is unfortunately still in use on a lot of websites, a lot of PHP's bad reputation goes back to these older versions of PHP.

However, PHP has had an unbelievable development throughout the recent versions (especially 7 and 8). 🚀

A lot of the bad design choices and security vulnerabilities of the past versions, which unfortunately hurt PHP's reputation a lot, are now gone 💨 And the developer experience is much better which makes PHP a great choice even for modern projects.

Conclusion... Will PHP take over again? 🔮

Good question... I don't know.

But the real question is: Does it matter?

Because in my opinion, what really matters is the developer behind an application and their skills and ideas 👩‍💻🧠

There are developers who build incredible web apps and websites with Laravel or WordPress and then there are developers who build incredible apps with React.

Both worlds are great and every programming language/framework has something unique to offer. I doubt anyone would regret choosing either of them at any point as long as they know how to make the best of it. 🤷‍♀️

But what do you think? Feel free to join the discussion in the comments. I'd love to hear your opinion!

Cheers.

Top comments (11)

Collapse
 
mario_d profile image
Mario D

Im a big fan of PHP’s simplicity, writing in it is a joyful to me and I barley ever end up stuck or limited by it. Especially because its so easy to extend.
It has been built for the web, but I hope with newer version and fingers crossed proper threading support at some point in the future, it can become a more general purpose language, and also be accepted as such.

This is kinda a shameless plug, but you can do things with PHP besides websites, apis and command line apps. Ive been working hard on bringing realtime games to PHP:
github.com/phpgl/php-towerdefense

Collapse
 
abc_wendsss profile image
Wendy Wong

Thanks Mario for sharing your Github page on PHP! :)

Collapse
 
fabiancdng profile image
Fabian Reinders

Wow! Thank you a lot for sharing this, really interesting. 🤩
And lovely project!

Collapse
 
abc_wendsss profile image
Wendy Wong

Thanks Fabian, well written article on PHP! :)

Thread Thread
 
fabiancdng profile image
Fabian Reinders

Thank you, appreciate your feedback! :)

Collapse
 
xwero profile image
david duymelinck

Great that a mainly javascript developer sees the value of PHP as a modern language!
But I'm sorry to read you are using Wordpress as an entry into the PHP community.

Wordpress doesn't use any of the standards that are common in the PHP world.
Their composer file is only for development purposes, which means they don't use any of the knowledge that is contained by the packages provided by the community.
It recommends a version, 7.4, that was end of live november 2022.
And there are many more flaws with Wordpress from a developers view.

Try Sulu, Statamic, Drupal if you want a free solution. If you want more simplicity and are willing to pay try OctoberCMS.
These CMS applications are more enjoyable as a developer to work with.

This is by no means a fanboy comment against Wordpress. I just dislike the way Wordpress demonstrates the use of PHP without most of the good things that are in the new versions. It is like using XMLHttpRequest instead of fetch in javascript.

Collapse
 
lexiebkm profile image
Alexander B.K.

PHP + Laravel + React is my current stack.
However, for backend, I am also interested in using Node.js (esp with Express), Go aka Golang (with Echo, Fiber or Gin or without framework), Java (with Spring or JEE) and C# + .Net. Currently I am learning them.

Collapse
 
fabiancdng profile image
Fabian Reinders

Awesome tech stack! Thank you for sharing! 🙂
My tech stack is mainly JS + React/Next.js + Go. But I've been working as a WordPress developer for the past year or so. My experience with PHP has been great so far but I think PHP development really shines when developing with Laravel.
Looks like such an awesome framework to work with! 🚀
Definitely need to get into Laravel in the future.

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

PHP's name later evolved to something more fancy, of course 😅 - "Hypertext Preprocessor".

Almost, you missed the "P". PHP stands for PHP Hypertext Preprocessor - a recursive acronym.

Collapse
 
fabiancdng profile image
Fabian Reinders

That's correct, of course! Thank you for the heads-up, appreciate it!

Collapse
 
lexiebkm profile image
Alexander B.K.

I am expecting PHP will adopt Promise, Async-Await like in Javascript. And... generics too, like in Java or C#.