Live data from Hacker News

PHP is the new JavaScript?

mux.com

51–60 of 88 posts

Re: PHP is the new JavaScript?

#51
post #33

Laravel + Vue is a popular and straight forward framework pairing. With all the shade in these comments, there's almost no suggestion for alternatives.

Ktor + jOOQ + Elm + OpenAPIv3 generators for generating a type-safe Elm client and Kotlin DTOs for the serverside.

IHP (Haskell) w/ HTMX.

Elm + Lamdera; for small games (super low boilerplate).

Hasura (Postgres + authorization exposed as GraphQL w/ generated schema) + Elm + GraphQL generator for generating a type-safe Elm client.

Rust + Yew w/ Actix or Axum on the backend.

Rust + Dioxus.

The thing I propose is: use something that makes it hard (near impossible) to express runtime errors. Life's to short for fixing bugs, and in many cases business is too fast to write 95% test cov. You need safety baked into your langs/tools.

Re: PHP is the new JavaScript?

#52

everytime I see PHP and python, it reminds that the best of the three main languages in the "slow / overly dynamic" lane (Ruby) got the short end of the stick for some reason, it's terrible

Python is pretty magical in places. PHP is slightly magical in places. But Ruby is magical everywhere.

Re: PHP is the new JavaScript?

#53
post #20

Money really changes people's perception. For more than 1 decade Silicon Valley bros considered PHP a bad,irrelevant, legacy programming language. Now, with a PHP framework receiving millions in funding, PHP is cool again.

Just VC money buying good press. PHP still shit. Not valley bros, just engineers that have worked many hours with several wildly different languages simply know what works well.

Re: PHP is the new JavaScript?

#55
post #4

Good old PHP is infinitively more easy to understand than React js soup.

With server-side only you need only one place to keep state. Then you have a stateless webserver that needs to persist all to a db. Those constraints make software easier.

React is just the view part in the browser. You still needs state management in the browser, which is NOT stateless like most web server apps. On top of that all browser apps still need a backend: so you manage state twice.

Re: PHP is the new JavaScript?

#56
post #8

> What happened? Well. Laravel happened (and has been happening). Funny, because Laravel was one of the things driving me away from PHP, in the same way that Rails drove me away from Ruby. PHP was becoming a salvageable language with some of the 7.0 changes, but if you don't dump 1000 pounds of gunk on top to make the easy things hard and there hard things dang near impossible, then you're not a "web artisan", I gues…

"the ORM didn't support composite keys" Well composite keys are a bad idea, so maybe it had a reason for that.

If an ORM can't be used to access a valid database, then that ORM sucks. (ORMs often suck for additional reasons, but that one's pretty hard to ignore if you have an existing database that you need to interact with.)

There are perfectly valid uses for composite keys. In a table that indicates a relationship between multiple other objects, for example.

Re: PHP is the new JavaScript?

#57
post #8

> What happened? Well. Laravel happened (and has been happening). Funny, because Laravel was one of the things driving me away from PHP, in the same way that Rails drove me away from Ruby. PHP was becoming a salvageable language with some of the 7.0 changes, but if you don't dump 1000 pounds of gunk on top to make the easy things hard and there hard things dang near impossible, then you're not a "web artisan", I gues…

ORMs only make easy things slightly easier. Complex queries are not expressable in ORMs, so you need SQL queries (usually as strings, in external files or generated with a tool like jOOQ/LINQ).

I think just doing all with SQL is easier to understand and maintain.

I see no benefit of ORM considering the small benefits vs cost of learning.

And your code become hugely dependent on them.

Re: PHP is the new JavaScript?

#58
post #11

I find it funny the author choose Symfony as a framework to "shudder" about. Considering the base of Laravel is Symfony. The rest of the article seems to be more about AI code editing and MUX video players then PHP. So I am not really sure what I am supposed to take from this post.

Back in the day we used Symfony at work. I have a vague feeling that some of my coworkers looked down on Laravel. Less dependency injection, more weird magic.

> I have a vague feeling that some of my coworkers looked down on Laravel. Less dependency injection, more weird magic.

Well, you can rest easy knowing it probably wasn't just a vague feeling, because I'm pretty sure every moderately experienced programmer who has tried both and went with Symfony feels that way.

Laravel was clearly written from the ground up with one goal above all else: to make it was easy as possible for beginners to write babby's first website as fast as humanly possible. Every other essential aspect of such a framework (maintainability, modularity, code clarity, ease of debugging complex issues, etc) was thrown to the wayside in favor of that one main goal, which is why there's so much "magic" everywhere. You're expected to just blindly trust the magic and never look behind the curtain. Unfortunately, beginner programmers that have no intention of ever evolving past their beginner phase are a huge audience nowadays, so you end up with many people who have never had to write or maintain a complex codebase hailing Laravel as the next coming of Christ.

This is all heavily reflected in this article: the author picks one of the most extremely simple use cases to implement, a 99% static page with a single dynamic variable that doesn't even seem to use a database. And despite the code being extremely simple, he still has to ask AI to write 90% of it for him because he isn't interested in learning how anything works, he isn't interested in expanding it or maintaining it in the future, he just wants to pump out the minimum viable product as fast as possible.

Re: PHP is the new JavaScript?

#59

I find it funny the author choose Symfony as a framework to "shudder" about. Considering the base of Laravel is Symfony. The rest of the article seems to be more about AI code editing and MUX video players then PHP. So I am not really sure what I am supposed to take from this post.

Laravel is really not great for some use cases, while with Symfony you have the flexibility of doing the things the way you want. For example, in Laravel you have the dependencies sprinkled all around the app and with Eloquent you kind of need to use active-record. I am not a big fan of Laravel but I think it is a great tool to build websites, not sure about data heavy backends.

Since I no longer work on big projects, I actually prefer Codeigniter. It's just simpler and yes, it doesn't do nearly as much as Laravel and I'm OK with that.

Re: PHP is the new JavaScript?

#60
Always thought React (specifically JSX) made JavaScript "the new PHP" in that there is markup all mixed in with syntax that is so similar to old school PHP.

"New school PHP" frameworks like Laravel are nearly exactly like Ruby-on-Rails: The same MVC style, database and ORM built-in, Laravel is so similar to Rails in many ways.

I would say:

"Laravel is the new Rails"

and

"New PHP is the old Python/Ruby"

The original dev use case for Wordpress where you can easily put up a basic CRUD app with user logins and roles/permissions was largely displaced by Django, which is just a little bit more mature of a project for such tasks than Wordpress could ever be. WP never wanted devs anyway, they wanted bloggers - so a lot of people stopped writing PHP simply because WP lost popularity as a web framework.

PHP lost a ton of up-and-coming developers to Python (esp. in academia) and JavaScript (esp. to Node), in the same way Flash/AS3 lost developers to iOS/Android. Unlike Flash, PHP never really died - just kept hanging around.

It's not a bad language, brings back fond memories at least. But there's nothing about its performance or usability that stands out, and there's no core platform need for it the way there was with Wordpress. JavaScript has the browser DOM and Node, Python has AI/ML libraries and best practices that aren't available in other languages, and in terms of another PHP use case - all the dynamic languages can quickly start an http server on localhost now. There's just no use case for PHP.

Post reply on HN