I miss the simplicity of web programming, back when performance was not king.
HTML was good enough for simple stuff, static stuff, but once you wanted dynamic resources, you run into a thousand different options (these days, at least).
PHP did a lot of things right, model-wise. It’s fair to say these choices hobbled its performance, but I just want to champion what some of those choices gained.
One file per endpoint
This is probably the best part: if you want /some/webpage.php available on your server, you just write webpage.php in some/ and you’re done. You don’t have to set up the route, in the right order, set up a 404 handler, et cetera.
I admit this is not the greatest performance: to read a file (from cache, ideally) at request time, execute it on-demand (using shared/pooled connections), but it is simple.
You edit your PHP file, you save, you reload. This is hard to beat.
I understand it’s beatable with “live reload” which usually involves some
live-reload.js listener with an open WebSocket or something. Bottom line is: this is not shit you’d be running in production, so it just starts to diverge from production setting. You didn’t need anything fancy.
If your PHP site is running with a production environment, it’s still got that same reload cycle.
Standalone web server
One server to run everything (like a servlet container) is definitely nice as far as centralizing connection pooling, load balancing across cores, etc. Applications don’t have to be designed to run on any one machine: server config & application code are cleanly divided. This is, of course, limiting in a way, and the abstraction might leak a bit.
This also makes hosting really easy, as once your server is installed, site maintenance becomes file maintenance. It’s not so difficult to imagine installing 2 different versions side by side as
foo13.5, and even running them simultaneously (if you wanted to run an older API codebase dependent on old framework, you easily could).
Tight DB integration
More magic as far as connection pooling goes. I don’t mind choosing one database to prefer, as long as that database is PostgreSQL. I’d be okay with a Redis-aware / -oriented framework.
I want to recognize some honorable mentions, some frameworks that really do deliver on some of the above, but aren’t quite as simple as I could hope:
Revenj is a framework very tightly integrated around PostgreSQL & Oracle, built for JVM & .NET
JSP was my favorite way of writing Java services
Rails delivers on all fronts fairly well, but is a bit more general-use
I haven’t written PHP since college, but it may be a good time to revisit. I don’t understand all of the words like Swoole and Workerman, and I kind of wanted Hack/HHVM as a language & runtime to take over (oh well), but PHP with equivalent features is .. well, more or less equivalent.