The curious relationship between Laravel and Node.js


Laravel, PHP / Thursday, December 14th, 2017

Even a cursory survey of skills (try LinkedIn) will tell you that a huge percentage of Laravel developers end up learning Node.js. The skills list goes something like this: “LAMP, Laravel, Ionic, Node, Full Stack Developer”. And it’s not just beginners bragging about their skill-set, mind you; I’ve met serious architects who passionately love LaravelĀ and use Node.js.

Why? I can think of a few reasons:

  • The Socket.io library has disgustingly good support for web sockets. When it comes to stuff like chatting and notifications, PHP has no answers while Node.js shines brighter than a thousand suns.
  • Node.js is JavaScript. Everyone learns JavaScript for the browser, and the transition to Node.js becomes easy.
  • It allows you to sprinkle words like “real-time”, “scalable” on to your profile.

Interestingly, you won’t see this skill combination with other, “lesser” PHP frameworks. CodeIgniter, CakePHP, or even WordPress, these developers tag themselves as “LAMP” and get it over with. They are bounded by the four walls of shared hosting, cPanel, GoDaddy and FileZilla, and they’re pretty happy in their wonderland. Node.js? What is that, a new plugin?

Even more interestingly, pure Node.js never give a shit about learning PHP. In fact, they adamantly stick to Node.js. Developers from other languages like Go, Elixir, Java, Scala, etc., never learn PHP. They also don’t learn Node.js. Why? Probably because their language ecosystems already have great support for web sockets and soft real-time communication (I hear the Netty server kicks some serious ass, and Elixir . . . well, that’s on a whole new level).

But more importantly, why do Laravel developers don’t get attracted to other alternatives? Why don’t Laravel developers get tired of the fact that Node is a disaster on multi-core CPUs? Or that it has hideous memory leak problems? Or that npm run build alone takes 1.6 GB of peak RAM? Or that the npm ecosystem is eccentric, to say the least? Or that Golang is much smaller, neater, easier to learn, and absolutely rock-solid?

We can never know the real reason, but I’ll attribute it to laziness. The bulk of PHP developers are not passionate (just dive into the Ruby and Python communities and you’ll know what I mean). Laravel has turned a bland language into something more enjoyable, but that’s about as far as the average developer is willing to explore. The more serious ones end up embracing Symfony, or go the framework-less way, but the other ones remain stuck with the language they know. Why make the massive effort of learning something new? Why not just rinse and repeat?

Any developer who learns these other languages seriously will drop PHP like a rotten banana. I say that as a PHP developer myself. Maybe I’m lazy, too?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.