Modern php code uses Frameworks, Package mangers, opcode caching, and application servers. It’s just that other languages don’t carry all the cruft php has in its heritage…
Back when I was building applications in PHP it was all frameworks. package managers, op code caching, etc. But I no longer do PHP development but for my own personal websites I still use PHP but in that most minimal form.
So where is the hyper-simple JS equivalent for that class of non-enterprise projects, is what I wonder...the enterprise stuff has always been heavy and loads projects down with maintenance debt.
I actually like using a reliable package manager, a wide ecosystem of good packages, and modern language features. There is nothing "heavy" about modern PHP, unless you want it to.
How do these change the way you can deploy PHP files by simply uploading them?
For frameworks, all you do is run a single command to install.
If you mean JS package managers, that's agnostic to what language you use.
Opcode caching doesn't require anything special from deployment point of view and I don't see a need for app server for PHP.
Once you start getting into zero-downtime deployments, you'll quickly see the need for both application servers like Swoole or RoadRunner, as well as strategies that don't leave requests in the air with half the code from the old version and the other half with the new one.
Let HackerNews hobby programmers snark all they want, those are very real problems with very real solutions.
And then again, you’ll end up wondering why your servers should waste cycles upon cycles for executing the same bootstrap code over and over again, if they could instead only do that once, keep the app in memory, and only execute the request handling code… and just like that, you’ll end up with Octane, or Swoole, or what-have-you.
The tendency to have a npm package for everything is overwhelming because you end up with choice paralysis and risk on picking "Oh, you picked CSV-to-array library #823, it's the buggy/insecure/unmaintained one."
… in your echo chamber. I know first hand of multiple very large corps doing that (one of them being a bank and this is their payment api) and very many smaller shops. Sure, we recommend against it, but saying it’s decades ago like that is nonsense; many people do this because it’s convenient.
Node typically IS the server. So, you could install express and have a simple web server listening on a port and serving up html or json in about 5 lines of code. Unlike PHP Node is not, in itself, a templating language. So if you want to render HTML pages you'd also need to install something like EJS, but generally node servers are just serving up JSON API, and your frontend would be some frontend framework (React, angular, vue). Although all of that is trending back the other way with NextJS the old is new again and server-side rendering is the hotness again.
Another option is to use a framework like NestJS. With that you do
# install the nest cli (only needed for starting a new project)
npm i -g @nestjs/cli
# scaffolds a new project
nest new project-name
cd project-name
# node server is now running on port 3000
npm start
For easy deploy. That was kinda Heroku's thing. You just "git push" a node project and it magically knows how to deploy it, but Heroku got bought by Sales Force and murdered from my understanding. There are a lot of alternatives though. AWS, Azure, Google, CloudFlare, Digital Ocean, etc, etc all have similar offerings where you just push a node project to git and it deploys automagically.Alternatively you can use AWS Lambda / Azure functions (or a dozen other "serverless" solutions) and you can just drop js files (functions) and they run on demand.
For a ProcessWire alternative there are a ton of options. A few I've seen are: Ghost, ButterCMS, Strapi
> AWS, Azure, Google, CloudFlare, Digital Ocean, etc
I'm always curious to know if there are more casual options in this space, for non-earthshaking projects. Maybe more like how DO was at the beginning?
Render.com, Fly.io, northflank. And I actually like AWS lambdas, so great option for me is SST.dev, which wraps AWS CDK, and provides an actual live development workflow with actual AWS resources.
Those people just use drop-in tools now which are better than custom applications for a large portion of standard use cases.
It doesn't need to even look like index.php, just needs to be as convenient, ideally?
Drop-in tools? Examples? I was using PHP drop-in tools back in 2004 but I'm not sure if that's what you mean.
> just install 10 insecure npm packages that each install another 10 npm packages
I still don't understand why companies are fine with this.
At my last job, even principal and staff level developers needed every Windows or Mac application install vetted by IT. We had real time system monitoring on all employee workstations that ate up half the RAM and CPU resources and constantly kicked us off the VPN for even the slightest quirk (including the CPU redlining due to scanning).
But npm dependencies? Nothing. Install whatever you want and push it to production.
This is an S&P 500 company that deals with tons of PII.
I'm not saying this is good, but the reality with these company-internal restrictions is, that the most productive people find ways around them and are rewarded for it.
There is a HUGE advantage to using the same language in the browser and on the server, and PHP isn't ever going to displace JavaScript in the browser. So JavaScript it is. That ship sailed a LONG time ago.
I much prefer not having to write JavaScript everywhere, not every problem is a nail and not every solution requires a hammer.
And in what concerns validation, it can be automated on most frameworks, which has to be done on server side anyway due to security concerns.
When people get what is peanuts in local currency of the owner company, whatever they are using doesn't matter and most sweet shops are experts in everything.
I can also tell that at the level I work on, salaries are the same regardless of FE, BE, DevOps, ...., specially because no one has a single role.
The point is it takes fewer people (or even the same person) to write less code (instead of writing everything twice, then trying to keep them in sync forever).
There's a fascinating deep discussion about SveltKit and other frameworks here:
Reacting To Web Hot Takes from Rich Harris - SVELTE STUFF
My favorite way to do this is to add a custom script to package.json like:
"start": "pm2 start index.js --name myapp --watch"
Any file change will reload the application and if it crashes it will be restarted. So just scp/rsync files if that's your desired workflow.
In my experience, it's far easier and faster than setting up nginx, apache, fpm, etc, etc.
What's the JS FOSS equivalent of ProcessWire as a CMF + CMS?
What's the JS equivalent to e.g. DreamHost and other drag + drop hosts?
(Legitimately curious, and I'm mainly inquiring after equivalents-for...better-thans would definitely be interesting)