Live data from Hacker News

PHP is the new JavaScript?

mux.com

31–40 of 88 posts

Re: PHP is the new JavaScript?

#31
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.

Laravel follows dubious practices: god objects (like a parent class which has hundreds of functions), static functions etc. The kind of practices our product is actively moving away from (originally based on Symfony 1 which had all the architectural issues Laravel has now), because it didn't scale beyond CRUD (makes it easy to write hard to support spaghetti code etc.). So it feels like a step backward... Especially when you learn they base it on top of Symfony which is already great and nicely designed.

Re: PHP is the new JavaScript?

#32
post #28

JS has done the impossible: It made me kinda appreciate PHP. I still despise PHP for its many design (it wasn't actually designed, it just happened) failures, but I've yet to see an application running on a single server with PHP, Apache and MariaDB run slower than "modern" JS slop that needs half a cluster to run the dozens of random object DBs and caches JS devs insist on using prematurely where the application tak…

> ...I envy TypeScript, though. I wish PHPDoc was more powerful... I just want ADTs.

You can get a lot of the way there with static analyzers like Psalm (psalm.dev). Annotate your functions/classes with detailed types in PHPDoc, and it'll verify that your code behaves consistently with those types.

Re: PHP is the new JavaScript?

#34

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.

Ha, this reminds me of a time I was proposing our team use Symfony rather than Laravel for a new project. It was such a battle.

Eventually I wrote up a document (I must have spent 20 hours on that thing) showing the pros and cons according to our needs and what each options offered. The gist of it was that Laravel was a nice wrapper over Symfony components at the time (though it did offer more as well, too - it just wasn't the more we needed), and since we were kind of like power users (data heavy backend with tens of thousands of users, rapidly growing), we should go direct to the source and use the Symfony components without any abstraction.

I mean, we shouldn't have been using PHP at all at the time, but what can you do.

Literally no one arguing for Laravel knew it was based around the Symfony components. Once the CTO saw that and heard me out, we didn't actually end up reviewing the Laravel option at all. I was so relieved.

Those were weird times. I'm not sure how much Laravel has changed since then. At the time it was kind of like an easy way to build simple stuff fast, but it didn't strike me as a great tool for our use case. We needed to make the most performant php-based booking system possible, and some basic benchmarking showed that Laravel introduced some incredible performance penalties that didn't make any sense for us.

Sometimes I miss that product. It had massive potential. I still stumble across it while booking stuff. The UI has barely changed. I suspect they haven't made many changes or made much progress since I left 7 years ago. I really wanted to build it into something better.

Long story short: Laravel wasn't the right choice for that kind of application, no one who wanted to use Laravel had any idea about its architecture but argued with me about it for weeks, haha. Write detailed documents to support your case, it works wonders.

Re: PHP is the new JavaScript?

#35
post #9

Why choose between PHP and JavaScript when you can write code in CASSIS, a language that runs in the syntactical intersection of both languages? For example: if (js()) { /* javascript */ } else { /* PHP */ } https://github.com/tantek/cassis

This is why we can't have nice things.

Re: PHP is the new JavaScript?

#36
To play on how every engineer is different, OP is excited about PHP because of a framework, while I'm having more fun than I've ever had explicitly _not_ using a framework!

(I am using the PSR standard interfaces[1], which means I can sub in any number of different libraries for different pieces of infrastructure. Including Laravel's. :D)

[1] https://www.php-fig.org/psr/

Re: PHP is the new JavaScript?

#38
post #9

Why choose between PHP and JavaScript when you can write code in CASSIS, a language that runs in the syntactical intersection of both languages? For example: if (js()) { /* javascript */ } else { /* PHP */ } https://github.com/tantek/cassis

https://tantek.com/cassis.js I don't know what to say, just that I wish I hadn't read this code

function sxg_to_num($s) is a beauty.

Re: PHP is the new JavaScript?

#40
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…

I get where you're coming from but recent versions are quite different. Specially with the new one which requires also PHP >8.2 afaik.

But having 30s requests in general should be a red flag into other systems, laravel surely won't take that much to bootstrap.

Post reply on HN