0

Php vs node.js

What is the best language for website backend php vs node.js

9th Sep 2020, 3:12 AM
Hriday Kalita
11 odpowiedzi
+ 7
The answer isn't a simple yes or no. Neither is overall better than the other. I, personally, would lean toward PHP but that's because I have more experience using it and won't need to learn as much to finish a project. I wouldn't recommend PHP over NodeJS to others as a general rule. For a given project, I would generally use whichever is most familiar to me or the development team that will work on the project in question. My past projects have mostly used PHP so I'd continue to do that unless NodeJS's advantages came into play. NodeJS would be good if project requirements leaned toward a single page application or a few NodeJS tools would be needed. AngularJS doesn't require NodeJS but that's a popular pair so documentation could be more helpful to use those together. Generating PDF files from HTML is a common requirement and a nodejs tool called puppeteer can do it. Enough nodejs-related tools like puppeteer and the project will be overall simpler using NodeJS than PHP. Fewer different languages = simpler. There is a more detailed comparison at: https://www.geeksforgeeks.org/php-vs-node-js/
9th Sep 2020, 5:15 AM
Josh Greig
Josh Greig - avatar
+ 10
Josh Greig I would avoid any articles from GFG. Your response alone was more authentic than the boilerplate book report from that article. Trust me on this... you'll be better off just skipping that website. 😉 That said, I've worked with PHP since 2008 and NodeJS since around 2012 and know both very well. For me, I personally favor NodeJS over PHP. I'm a huge fan of Javascript on V8, Babel, TypeScript, the built in HTTP web server and so much more. I prefer the unit testing libraries, websockets, async / await, building RESTful APIs on NodeJS, package managers, debugging experience, isomorphic options, and over all developer workflow tools that are so naturally supported in NodeJS. NodeJS can also be used to build utilities as console apps, Windows services / daemons, and microservices, among other things. If you love PHP, I think you would love NodeJS even more once you've over come the learning curve. Until then, you won't miss what you don't know about. 😉
9th Sep 2020, 7:12 AM
David Carroll
David Carroll - avatar
+ 6
David Carroll Loved the answer sir 🙂👍
9th Sep 2020, 7:15 AM
Nilesh
Nilesh - avatar
+ 4
David Carroll Josh Greig good answers to you both, thanks. but realistically how often do you get you make these decisions in a vacuum? doesn't existing infrastructure have an enormous impact on these development decisions? and doesn't the structure and amount of data you are managing also have a huge impact on this decision given php goes with relational database models and node.js favors object document dayabases?? ty again for your involvement!
9th Sep 2020, 11:20 AM
Lisa F
Lisa F - avatar
+ 3
Lisa F You bring up an excellent point about external factors that may play a role in such technology decisions. That said, I personally have never worked at a company where PHP was a primary staple for new development. It's been a language we've either inherited from another firm or was the language used by some open source project used by a client. I've worked quite a bit with WordPress, Magento, Moodle, SugarCRM, Joomla, and Learning Locker (before it was rewritten to NodeJS). More often than not, I've been involved in rewriting custom PHP projects into some other platform. One thing I do want to point out is that I completely disagree with the opinion that data storage requirements have any influence on using PHP or NodeJS. I've successfully worked with both types of databases in both platforms and never thought one DB was better suited with either language. Unless I'm missing something, I did notice this talking point on some websites that might be propagating this unfounded comparison.
9th Sep 2020, 12:57 PM
David Carroll
David Carroll - avatar
+ 3
David Carroll mongodb, an object document database model is in the MEAN stack with node. not mysql .... so one gets the impression that there's more support, experience, so forth with node and object oriented databases, not with relational databases and vice versa for php. I also think there is a lack of relational design among younger programmers who learn/understand the object oriented way of saving data....hence the nod goes to mongodb for them for data management.
9th Sep 2020, 2:35 PM
Lisa F
Lisa F - avatar
+ 3
Node. js is the best, for api's and all sorts of databases, i use node.js all the way, for my websites and api's
10th Sep 2020, 4:17 PM
John Daniels
John Daniels - avatar
+ 2
Lisa F So... I guess the whole MEAN / MERN / LAMP / etc alphabet soup of stacks is probably causing some confusion among the learner community. I hadn't considered the unintended consequences that might have come from these simplification attempts in bundling various technologies as such. MEAN was probably coined as an alternative to the popularized [L,M,W]AMP stacks as a fully bundled all Javascript tech stack for the DB, web service, server runtime, and client framework. MERN came later with the release of ReactJS. While MEAN and MERN typically focused on the Javascript bundles, the _ AMP bundles expanded its meaning to support variants as follows: M - MySQL / MariaDB / MongoDB P - PHP / Perl / Python But these have fallen apart as LAMP has been made to generically refer to other technologies that don't follow the acronym pattern. These include other web servers like nginx, IIS, Lighttpd as alternatives to A for Apache, or databases that don't start with M and so on.
9th Sep 2020, 4:19 PM
David Carroll
David Carroll - avatar
+ 2
David Carroll really excellent summarization of the stack acronyms. thanks!
11th Sep 2020, 11:06 AM
Lisa F
Lisa F - avatar
+ 1
Thanks for help
9th Sep 2020, 7:09 AM
Hriday Kalita
0
I decided I go to node.js because I will make a stream website
9th Sep 2020, 7:11 AM
Hriday Kalita