Live data from Hacker News

PHP is the new JavaScript?

mux.com

41–50 of 88 posts

Re: PHP is the new JavaScript?

#41
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

The HyperTalk support is touching

Re: PHP is the new JavaScript?

#43
post #39

Bit worrying that the first code example given in the blog isn't valid PHP. Strings are concatenated with the . operator, not +. https://3v4l.org/v9tFN Or in older PHP versions it would output a number (because it would cast the strings to 0).

But that's an example of something crappy someone would throw together in 1998 and FTP up to their provider of choice.

Re: PHP is the new JavaScript?

#44
Forget the framework, forget the AI assistant. What are PHP developers like these days?

Awhile back, we wrote an MVP, a proof of concept, using Wordpress. I dug around some of the plugins and themes we used, and my god, it's still garbage. Things being shipped with huge swaths of code just commented out, spaces & tabs intermixed for indentation, TODOs littering the codebase. Things that were just flat out broken.

I used to be a PHP developer, and the habits that I learned probably stunted my professional career by a good decade. And from what I've seen - granted, in a very limited exposure - tells me that most PHP developers still write garbage code. Weirdly, I've even seen examples at work where developers write perfectly cromulent Elixir and Javascript/Typescript, but somehow revert back to the fecal firehose when it comes to writing PHP code.

I don't care how good Symfony or Laravel is. I care about what happens when my employer hires someone who can't write good code, and in my experience, the odds of that increase hugely when we talk about PHP.

Re: PHP is the new JavaScript?

#45
There's been enormous improvements to PHP's performance and to the language itself over the past couple decades. It's something worthy of praise.

That being said, it's not the "new Javascript". Javascript isn't dominant because of Node.js or anything like that, but because it runs in every major web browser. Whether you like it or not, Javascript is essentially part of the web itself.

Re: PHP is the new JavaScript?

#46
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

Hahaha I love this comment and love that this is a thing.

Re: PHP is the new JavaScript?

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

Hearing these negative laravel opinions is super interesting. As someone who absolutely dreads working with php, I’ve always been curious about laravel cause people seem to love it so much.

As someone who has worked in a lot of languages and a lot of frameworks, I never understood the hype around Laravel. It's very opinionated as to how you structure your application but it gives you very little for forcing all that structure. I thought it would be and should be more batteries included. And the active-record style ORM is also not my cup of tea.

Re: PHP is the new JavaScript?

#48
The comments on this thread are interesting. I use Laravel extensively. For big applications, serving lots of users. It works when the application is relatively complex, and the ecosystem is second to none. Need to just throw it up on a server? There's Forge[1]. A better CI/CD process? Envoyer[2]. Want serverless? Not for me, but Fathom[3] use it to deal with >100Ms of hits a day; there's Vapor[4]. All three of those are Laravel developed and maintained solutions.

If I'm throwing something small together then sure, I'll maybe use Flask or something lightweight[5]. But Laravel is very good for nearly every use-case where you intend to actually build something.

Then there's the bigger question: if you're building to meet a business use case, or well, to make money, then why wouldn't you use the most complete scaffold possible? I'd say Laravel is that. If it's too much of a pain to do something in PHP I can just stick in a call to a python file or really whatever language I want. But for the basics? A db? Auth? and lots of other stuff that I never want to personally build again? Yeah, give me Laravel everyday.

[1] https://forge.laravel.com/ [2] https://envoyer.io/ [3] https://usefathom.com/ [4] https://vapor.laravel.com/ [5] To prove I'm not a shill, this is from literally last night: https://github.com/simonminton/consensus-article

Re: PHP is the new JavaScript?

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

Composite keys are fine as long as all the key columns are surrogate keys.

Re: PHP is the new JavaScript?

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

Granted, this was on some virtual machine on a computer from 2007. But I did pare it down and down until all that was left was Laravel itself, doing "nothing".

I don't find it all that surprising. Overly-complex startup times are the convention for web frameworks that want to be taken seriously [by koolaid-driven managers]. These days I'm forced to work with Spring Boot, and it also takes for-eh-ver to get to the point where it can run my code. According to the logs, it's a lot of walking the classpath to find every different class and figure out how to assemble them into an application. Because heaven forbid someone call a constructor to make the object they want.

Post reply on HN