Is anyone here prefers Node over PHP for Backend?
For further actions, you may consider blocking this person and/or reporting abuse
Is anyone here prefers Node over PHP for Backend?
For further actions, you may consider blocking this person and/or reporting abuse
Aleksander Wons -
Gaung Ramadhan -
Germán Lozickyj -
Sh Raj -
Latest comments (71)
PHP vs Node is not a valid comparison. PHP is a language whereas Node is a JS runtime. PHP seems little primitive to me. Node is more efficient for Asynchronous / Non Blocking systems. Node is basically a good VM lacking a good language.
Node is the best for BFF applications
PHP is the best for enterprise application with a lot of business logic
You should choose the platform for your current aims
You should choose NodeJS if:
In other cases (especially if you want your application to be secure and reliable) you should choose PHP
Long story short, the main differences are:
I prefer PHP. As much as I use node (express, adonisJs etc) perhaps it could be because of my experience, I think until I have specific requirements that requires the strengths of node, I would choose Laravel everytime.
I love node no doubt, but I seem to have enjoyed alot or stability in my existing PHP backend systems.
In short it depends. Use node.js if you work with real-time socket io app, event based system or with multiple threads.
That might be simpler than trying to achieve something like that in php.
On another hand php let's you write really nice run and exit programs faster. Also with php it's really nice to work in oop and with variables, because you don't need to handle undefined, null and other similar problems. Also I like php arrays and JavaScript fuckery kind of sucks.
Overall I use php on large projects where I need stable and secure system.
Node.js is kind of new and still you can't trust it on Enterprise level.
If you read somewhere that php is insecure it's wrong. People who never worked in php and back end wrote it or they are just script kiddes who used old WordPress and got spam and viruses inserted. Tho we can all agree WordPress is trash. Why they still use plain php for templates? Lol.
Either, depending entirely on the requirements. PHP full-stack web frameworks are lightyears ahead of Node frameworks in terms of feature completeness and stability (Symfony mostly, Laravel in some parts). So it really depends on what kind of backend you are building. Heavily database-backed REST? You'd probably choose Symfony or API Platform. Have async io and/or WebSockets? Go for Node. Or better yet, Vert.X on JVM.
The best answer so far! What do you think of Prisma or some Headless CMS, would you consider it as an alternative to API Platform?
API Platform is usually fine if you are looking to build something serious or potentially / eventually serious. It's based on Symfony so you won't go wrong there, and you get batteries included to work with your data models and build APIs - the drawback is you have to learn how to do it first - headless CMS's are usually much simpler.
That being said, you might as well choose vanilla Symfony with Webpack Encore if you want a somewhat simple API driven backend with the attached Web frontend. For bootstrapping and prototyping medium complexity projects this is also fine.
If, however, the only thing you need is plain CRUD and you do not foresee a serious need for future customization, headless CMS is the way to go from a productivity standpoint. From those, Strapi (Node) and Directus (PHP) are my favorites. Feel free to demo both and see which one could be best for you.
As far as Prisma - interesting project, haven't used it. From the birdseye view looks like it's a database mapping library and it generates a static client to the database from a database schema - and if it works as advertised and without the cloud component, it could be very useful in some use cases. There are some drawbacks and gotchas to schema-driven code generation though - conceptually, your database abstraction is "database-first" and your codebase is no longer your single source of truth. Then comes ensuring everyone has the same generated code version, how do you share the generated code, etc. This is by no means a new concept - such tools have existed for quite some time now in platforms where code generation is more common, ex. see JOOQ.
I am doing my project with Node already more than a year now. Cloud functions in Firebase and REST with Express. It got wild and chaotic. I can't get it organized. I can't even test it properly. While at work I am getting deeper with Symfony, which got all those Bundles, Interfaces, DI.
So I am hesitating now on how to proceed. I want to get most of logic out of cloud functions and do them as microservices. What I want to achieve is a good logging and some admin panel to be able to navigate quickly and flexible through the data. So far I understand that the best way to connect microservices is through some kind of queue and state machine. Firebase has a big limitation on filtering (which I need most for admin) and I am afraid I can't control the costs (it can get wild with more data), so I want to move all logic on own server and be able limit what and when to process. So far all triggers are on onWrite functions of Firestore documents. So it can get out of control real quick. I haven't found yet any alternative to Symfony in Node yet, that can allow me to do all the things. Neither I can migrate 100% to PHP, because there are some packages that only available in Node.
After a while working with Firebase it gets annoying, because you have to find workarounds to build your data model. Normalized thinking from MySQL you can forget right away. Neither NoSQL thinking works, because Firebase is not flexible enough with queries.
It's very painful and annoying. I already have an idea how to build it with API Platform in a way, but I want to give it a chance everything based on Node. Unfortunately I can't find good examples of something complex built on Node and it's like walking around and trying to find all the small pieces first and build a new thing. That always felt wrong in PHP world. There is always something working out there, some framework, some concept, some structure. In Node it feels like lots of small libraries which do the same thing and have releases faster than I deploy a new version of the app. And sometimes projects just get archived without any explanation of what happened.
I still have hopes that I have wrong perception and it's just takes time to learn and find a right thing.
The question should be the other way around.
Node has:
Now, what does PHP has to offer?
Node
You mean do I prefer a better language, in a more consistent platform, with the largest third party developer ecosystem software has ever seen?
Yes. Personally, I cannot stand PHP. Nearly every common complaint about JS applies to PHP and then some.
Python 🐍🐍🐍
Want sink included? Django 😍😍
Want something lightweight? Flask 🤙
PHP should be relegated to legacy software from 2003. 💩💩💩
Don't know enough about node to judge, but JavaScript is nice.
Python is cool... There are some interesting libraries for rust as well. I tend to favor node myself. I've never liked PHP, not to mention node/js jobs tend to pay better, especially if you're experienced with react.
😍✋😁
I have professional experience with both PHP (almost 15 years, from 4.3 to 7.1) and Node.js (2 years, however I already knew javascript, so I wasn't starting from scratch). I'm no longer using PHP for any project, as to me, there's no comparison. I always felt PHP was a big mess, with poor backward compatibility
(just showing how poorly designed it is) and very prone to difficult to find bugs, and also, I don't like stateless systems and with PHP you need to keep saving and reloading a state to approach a stateful system, which also slows down the request. With good programming in Node.js, you can achieve much faster speed and much more easily (no need for the above tricks). Something like caching is a piece of cake in Node, or anything involving real time, such as a chat.
I think a lot of PHP users who never tried Node.js are going to say PHP is better, but I think people who have in experience in both most probably prefer Node.js, by far.
i bet a thousand dollars that you never used Symfony or Laravel, or even TDD.
We have common experience. Same story here. Recently I discovered Symfony Workflow which I love so much, but I can't really imagine how to build something similar with Node. Could you have a look at dev.to/razbakov/symfony-workflow-a...
Depending on your final goal I can give you advice.
As is, this is too open and will end in personal preference.
PHP using Laravel is still worth for me on most of my current projects with all awesome libs and features that easy and quick to implement.
In other hand, I also use NodeJs specially using ExpressJs for a project that I think it shouldn't use PHP at all, e.g all requirements are depended on npm packages.
Conclusion, you can feel it whether is the best or not by yourself. :)
I mostly work with PHP (Laravel) for backend with angular or react as frontend. I also use Node from time to time. Depends on the project to be honest.
Personally, I don't really have any preference that I HAVE to use one over the other :P
Some comments may only be visible to logged-in visitors. Sign in to view all comments.