Ask HN: Any open problems in PHP that need solving?
I’ve have a decade of PHP development under my belt and have been reflecting on why PHP, despite recent improvements to language, is still problematic. One side of me says that the community should just let PHP be “PHP”; if a Typescript for PHP were made, would the community embrace it or lament it? The other side of me says that it’s not PHP, the language, that is problematic, it’s simply _how_ it is used; for example, PHP frameworks—although useful and serve a purpose—don’t really result in less debugging time nor do they make code more literate or smaller in scope.
So the question I pose is: A. Should PHP as a language be augmented, like TS does for JS, or B. Should the community focus on the methodology of PHP to make development simpler? What are some concrete propositions you can imagine that argue for either case?
I think any PHP developer can propose more than one new feature they would like to see. As for A, I personally would like to see an actual native module system. As for B, I would like to see less MVC frameworks and more macro systems within the ecosystem.
(
10 comments
| 3 points
| on HN
)
it feels like certain style which was popular a decade ago, now seems not so exciting or new. Probably that vibe is what lost with php.
But then if you like to find try out other language like Kotlin, Haskell, Elixir or even Ruby.
I think there are other language communities are much more vibrant than php. For example python, ruby, java. Also these language have expanded their beyond just web development that also kind of fueled that adoption.
personally i have moved to GO some years ago after over a decade with php. not because i had enough of it. no, i love php. but there is no money in web development anymore. so i moved to a compiled languge and do purely backend and less web/front oriented stuff, which i always preferred anyway.
though before i left php i remember that i was getting interested in parallel computing and Go had goriutines which served me well. php was getting the reactphp, swoole and other projects at that time but i decided to change the direction so even if it would work for me at that time, now i do more lower level stuff that php would not be suitable for anymore anyway.
I also had a decade of PHP experience before transitioning to nodejs in the last few years. I first transitioned for my day job, and then also started using node for hobby projects. For hobby projects I like to keep things as simple and quick as possible (translation: so no React frontend and all that stuff), so I was trying to emulate how PHP does things and just have my node server render html from the server. I've found that almost any way I try to do it, it's a little bit more awkward in node and you end up having to choose from one of the dozen of templating libraries and learn their syntax (no-go for me).
In PHP one of my favorite things is, say you pick up a super simple routing lib like ToroPHP. In your route handlers you could skip all templating libraries altogether and simply require() a .php file that is your view html. It would simply be a file that contains HTML where you could sprinkle php statements anywhere. It's just about the the best/easiest way to template HTML output from the server for hobby projects (and I argue even for larger projects too in many cases).
What I end up doing for hobby projects in node now is usually going JAM stack. Build my frontend in Svelte (which is as close to no framework as possible), and build API server in node with Fastify. I guess where I'm going with that is that a setup like that isn't much more hassles than doing PHP and html templating for these small projects.
b) yes
I'm pretty happy with what php has become. Don't really understand the typescript benefit here.
I would like to see a popular async framework.
https://github.com/walkor/phpsocket.io