DEV Community

Discussion on: PHP vs Node.js

koas profile image

As far as I'm concerned, it's not PHP vs Node but PHP and Node.

Programmers that have been using PHP for years can benefit of Node in many ways. I personally use it for PDF generation (using Puppeteer) and as a WebSockets server.

I've never used Node for anything else, but from what I've read Node is still a bit far from what frameworks like Laravel (or Rails or Django) can give you out of the box. That may have changed or will change in the future though.

Today a lot of logic has moved to the front, and JS has become a very popular language, so for new programmers it may make sense to learn JS and develop their server side logic with Node. People beginning their career in web development these days are already overwhelmed with lots of things to learn, so if you can reuse your language knowledge to write the server logic it's a win.

But I still think that some tools are best suited for some tasks and, from what I've read and my own Node experience, I don't think Node is as good as PHP for a big size web apps. Frameworks like Laravel are mature, well documented and give you many features out of the box. To achieve the same results in Node you would have to write a lot more code and use many modules.

So, why not use the best tool for the job?

If you know PHP (or Ruby or Python) I think you should write your server side logic in PHP, and use Node for tasks that are far easier to do in Node.

If you only know JS go ahead and write your server side logic in Node. But if you have the time I'd recommend you to look for server side frameworks in other languages that may make things easier for you.