Hacker News new | ask | show | jobs
by pampa 1 day ago
Laravel didn't really take advantages of the php language.

It was a baroque implementation of a rails-style framework, that was heavily influenced by enterprise java coding style.

4 comments

It is not baroque, particularly (no more than Rails itself), and it clearly did make good use of PHP, IMO (particularly recent PHP).

It's rather elegant, and exceptionally well-documented.

However it is probably not what you want for an app in the LLM era. There seem to be considerable simplifications in this design that are more appropriate for Go.

The main advantage here will be the integration with Inertia, though I guess Livewire is a much bigger challenge to implement.

> and exceptionally well-documented.

Against the average PHP project perhaps but against Symfony it's not.

Laravel documentation has always focused primarily on the new user forgetting that the thing about new users is that it is a temporary state.

It worked for them clearly so hard to say it's a bad idea but I always (and still do) prefer the way Symfony more thoroughly documents everything.

> that the thing about new users is that it is a temporary state

Not so much. When you come back to an app after years, this clarity of purpose is useful. Or when you have 32 years of built-up web developer cruft in your head.

Laravel has first class LLM and agent support. I’m as bit curious why you would say it’s “probably not what you want”.

https://laravel.com/php/docs/installation#laravel-and-ai

I wonder about that as well. Laravel is so easy to work with, read and whatnot. If anything the comment means people shouldn't care about code simplicity anymore (because of LLMs), which I oppose, a lot.
Nothing wronf with laravel (php) in llm era
Nothing wrong with Laravel.

The LLM era has made running any scripting language on a public-facing service a greater security risk.

In PHP's case, I currently judge that risk as unacceptable (and I've made a living off developing in PHP for decades).

Why would you write PHP with LLMs? The whole point of PHP / laravel is trading performance for speed of development. LLMs inherently solve speed of development so why even use PHP any more unless you're supporting a legacy code base?

I've worked on a single laravel project in the past and I didn't like it. Whenever I needed something just a little more complex than what the docs suggested I felt I had no way of figuring out how to do it and support forums were scarce of solutions.

For the same reason you would build something in React in the LLM era... because it's what the LLMs are good at. What Laravel has going for it is that it's opinionated, those opinions are conventions (loosely) and that is consistency. That results in llms being very good at building laravel things the laravel way.

In the same way they're great at building things on React.

But I don't know, I'm just some rando who built a whole huge ass "factory" (that would be an understatement) on Laravel, for mostly (albeit, here lately, mostly not) Laravel projects and it's _insane_. I may be biased. I may also be lucky to have jumped on that bandwagon.

And why follow it to Rust/Go? Same reason. The opinionated wave of consistency and quality into languages with different strengths.

> you would build something in React in the LLM era... because it's what the LLMs are good at

LLMs are very good at rust / go too. Rust / Go are also a lot more performant than php / laravel

> And why follow it to Rust/Go? Same reason

except if you want performance and decide to go for Rust / Go then LLMs wouldn't have been trained on laravel for rust / go because it's new so you'd be better off using an old framework.

LLMs do not care. I have written my own language/repl/vm in C3, and an AI generates my own language just fine. Its a totally new language, new syntax with semi general semantics (its basicallt go channels on an beam like runtime) that have (and will always have) one user, me.
Who guarantees that LLMs will generate code that fulfils quality and security requirements? A human still has to be responsible for the resulting product and when the human can't follow what the AI does, it is worthless. For a human to follow the AI results he has to read and understand the code, which brings us back to a well documented framework that helps to follow along.
> Whenever I needed something just a little more complex than what the docs suggested I felt I had no way of figuring out how to do it and support forums were scarce of solutions

Details ?

Laravel docs & ecosystem are top-shelf

Laravel docs are the best I've ever encountered in the web dev business.
> The whole point of PHP / laravel is trading performance for speed of development.

(For my 12-year-old self, it was being able to push a bunch of .php to a free host and have them run. I later even considered learning Haxe to have a better language while still being able to compile to PHP for that use case.)

Just ask the LLM to output assembly directly then. As long as nobody ever has to answer questions about the code, it'll be ok.
On the other hand, why would you prefer any human-readable programming language or framework over another in the age of LLMs?

Like, why stop at Rust or Go when LLMs will soon be able to generate binaries for your target architecture better than any compiler can. The LLM could be writing dark verses in brainfuck behind the scenes for all I know. It doesn't matter anymore because we're not gonna read any of it.

Because they won’t be able to write assembly well. LLMs rely on strong guardrails and tools to perform well.

PHP performs poorly with LLMs not because it’s readable, but because it’s too dynamic and wishy-washy. Statically typed languages and strongly typed languages just perform better out of the gate, because the LLM has more context to reason about the code.

I program in PHP all day, I know. PHP is a bad language for LLMs. C# is better, Java is better, rust is better. LLMs will never replace compilers because they don’t need to. What compilers provide is a rich information system and strict structure. That’s exactly what LLMs rely on.

> Because they won’t be able to write assembly well.

They already do a good enough job, it is only a matter of improving it.

https://www.phoronix.com/news/Frame-X11-Server-Assembly

> I program in PHP all day, I know. PHP is a bad language for LLMs. C# is better, Java is better, rust is better

I also work in PHP with LLMs and have no idea what you're talking about

> I program in PHP all day, I know. PHP is a bad language for LLMs.

That statement is so absurdly false that I'm fully convinced you never used an LLM for serious PHP development.

Why drive a car when you can teleport in the future?
Introducing BFCode... the Brainfuck llm you didnt know you needed
Livewire will likely not be ported in the near future as it is a sort of framework for Laravel PHP itself. Its also owned and maintained by a different developer but got the blessing to use the official name from Taylor himself.

Of course, that could change tomorrow with a fork, but idk if we’ll see if. If the agent is writing the code, it can slop out the same UI with Inertia. Tbh Livewire and Inertia are quite similar in that at their core, they are more both wire protocols with well defined behavior and outputs. The difference is that Inertia targets json as an output format and Livewire returns html/blade in a manner not terribly different from HTMX (though not the same and with more JS under the hood).

Its 95% lipstick on php warts.
Nothing is elegant about modern php. Maybe the lambdas with 'use' keywords.

You have request()->params, response() in the framework But all the raw data is still there in $_GET & $_POST, file_get_contents('php://input'). You can still echo "" to the browser, and still send header() from everywhere.

It almost looks like php developers around 2009 were really wanting to write enterprise Java, but had to use php at their day jobs, so they gradually made php pretend to be something else.

> Nothing is elegant about modern php. Maybe the lambdas with 'use' keywords.

I was not talking about PHP, but Laravel.

yet at the same time, you can do stuff like this in PHP:

  $result = '  PHP 8.6  '
    |> trim(...)
    |> strtolower(...)
    |> str_replace(' ', '-', ?)
    |> (fn(string $s): string => match ($s) {
        'php-8.6' => 'New hotness!',
        default   => 'Something else',
    });
People always seem to get hung up on the standard library and the runtime, but the language itself is amazing by now.
I still like and enjoy PHP. But after PHP2Shell I am done with it and any other scripting languages for future server-side web projects.

I think scripting languages tend to represent too great an attack surface, for humdrum reasons (like over-capable default configurations).

So I welcome this effort (not least because I quite like Go)

Funny, I saw a comment here on another thread postulating that scripting languages / languages with runtimes would be more popular in the feature because of the fast time to patch vulnerabilities on running machines, whereas with Rust and the like you'd have to deal with long compile times...
I've got bad news for you if one hard to exploit vulnerability on the language is the Rubicon to you
Hmm... many other "modern" languages can do the same thing.
The only other languages with similar features I know of would be F#, Elixir, probably OCaml. I wouldn't call that "many". Also, it's besides the point I was making; PHP is a capable, JIT-compiled scripting language by now, including a fully optional, gradual, yet runtime-enforced type system; fibers/green threads, generators, streams, FFI, pluggable SAPIs, etc.; great performance, especially so with JIT and opcode caching enabled; and a lot more. On top of that, you get an extremely well-maintained ecosystem with a single, standard package manager that avoids many of the supply chain security issues of other ecosystems, several healthy application servers and widely used frameworks, ubiquitous tooling and integrations...

There's a lot to criticise about PHP, but also a lot to like.

You hanging on the syntax. Many programming languages provide functional primitives, which is what you're talking about. Yes, the |> operator is specific to some languages.
I look at that and "amazing" is not how I'd describe what I'm seeing.
Piping is an amazing language feature, but it can be easier or harder to read based on the syntax.
Thats pure lol. Looks like a pipe ala ocaml would be a REALLY bad fit for the php stdlib.
It really depends on what you mean by detail.

Laravel uses autoloading (so as most other PHP frameworks), and magic methods (https://www.php.net/manual/en/language.oop5.magic.php) etc, which are features of PHP language.

Of course you can replace most of them, for example, swap `__get` with a manually implemented `.get`, but then you're talking about general programming patterns, not language/framework any more.

For Go specifically, it don't have class method override or even class, the `struct` embedding works a little bit differently. So at least that part will be different, and the difference will probably water fall all the way down to the point it effects how user use the framework.

On the contrary, Laravel took advantage of all the dynamic features of PHP to great effect. It's the only way they could manage to come close to Rails' level of magic.
I don’t know - when we tried Laravel for a $job, it was a disaster - overcomplicated mess of facades and dependency-injected abstractions which breaks in a non-trivial ways after each update.

It is some sort of a cargo cult engineering where you feel like you’re building a legacy enterprise app to achieve trivial outcomes.

Not worth it at all.

But Go is great as is, not need for a Laravel on top.

Yep. Exactly my experience with laravel. Enterprise java patterns in a dynamic language, without compile time safety net. Write once is ok, long term support is problematic.
Not to mention that putting a heavy-weight framework on top of a language like PHP is not exactly good for performance...
it is built on symfony, and a heavy part of it was the doctrine ORM, until very recently. i don't think it was laravel solely taking those patterns, but you are right that it was heavily rails inspired. i would wager that these recent steps are also DHH inspired, who taylor otwell amires.