Hacker News new | ask | show | jobs
by jerf 1 day ago
And also supposedly in Rust too? https://github.com/laravel/rust-framework

I don't get this. Frameworks generally end up tied to their implementation language because they should be taking maximum advantage of whatever the language provides. You can non-idiomatically port a framework out of its home language and retain similarity as is possible, while still possibly losing some things that just can't be ported, or you can idiomatically port the framework in to the new language and get something that is harmonious with the new language but has significant deviations from the original.

Or you can split the difference and get the worst of both worlds.

It's not like you can take something that implements some particular authorization technique and cross that module between languages.

And the gap between PHP to either of Rust or Go is enormous, meaning the gap between the two choices I outline above is also going to be quite substantial.

8 comments

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.

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.

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.

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.
The only downside is even though he says Laravel is not going anywhere people will still panic and some companies might attempt to jump ship to literally any other PHP framework.
Laravel doesn't need anything besides eventual security updates and PHP version upgrades, why would anyone panic?
To what framework? Symfony?
I'm waiting for Django assembly
Amen to that, that would be like mental floss.
You say this as if it's something bad.
I always preferred Symfony over Laravel when I had to make PHP things. Laravel is awesome, but Symfony always struck me as the right tool when you know exactly what you need (besides a different language).
Can’t see that happening.
To be fair, I see it happening less so with PHP, but with either Go or Rust it could be a possibility.
I really don't get to whose is this for, Laravel folks chose it because of PHP, and if I would be using Go or Rust, I would pick something designed for them in first place, not a port from another framework.

Just like I would not use Spring for .NET, or ASP.NET MVC for Java.

I don’t choose Laravel because of PHP, I choose it in spite of PHP. Larval is an incredibly ergonomic framework.
Well, PHP developers migrating to Go, I guess? But AFAIK the Go community still prefers a "library-type" approach to development (or, if at all, lighter frameworks) rather than using Laravel-type frameworks that dictate how you should structure your application.
Still, they would be better off picking a Go "native" framework.

I never felt that it was a major issue while moving between ecosystems, to carry old patterns around, that is how you get the old meme "You can code FORTRAN in any language".

As a Laravel dev, this absolutely wants me to check out Rust & Go. They were quite intimidating previously.
You simply don't understand how LIGHTYEARS ahead of any other web framework Laravel is.

I've used multiple frameworks in Java, TypeScript, Python and probably other languages that I forgot, and Laravel is literally existing in a superior plane compared to any of them.

The simple fact that it's available in other languages makes those languages more attractive.

I have been programming since 1986, Web development since 1997, worked on a startup that had "Rails" with Tcl, the founders went on to create one of the very first RAD environments for Web, OutSystems.

Know PHP since version 5, and have put up with it on my ISP hosting.

Yeah, I really don't understand.

Indeed, looks like you don't.
It doesn't seem like they're going for exact ports of the framework as there are significant differences in the implementations and APIs of each. For example, in the Rust version they can guarantee at compile time that routes can only be called under certain circumstances (via Axum extractors), such as with an authenticated user, whereas the Go version has to resort to runtime checks/errors. The Go database layer also seems to have similar issues and I imagine the Go type system is just far too limiting to get all the way to something comparable to Rust, Ocaml, C#, Java or especially frameworks in dynamically typed languages. There's definitely issues in some of their use of Go channels as well.

Edit: The Go database and validation layers also use struct tags and runtime reflection all over the place which is truly disgusting but typical for Go.

Indeed — it's at least a bit closer to idiomatic Go than an "identical" port would be.

It's somewhat like the unofficial "Goravel" port.

Yup! Released yesterday.
For PHP (really Laravel) devs who wont be writing this code (LLMs will write it) but will be reading it.

LLMs write rust pretty well and since it is C++ performance without c++ baggage and so everyone is "rewritting" their stuff in it because no one gives a shit about devex if the dev is not really required.

This is all covered in the announcements. You should probably read/watch those first so you are addressing specific concerns rather than pontificating.
Sir, this is HackerNews; we don't do that here.
So.. back when Claude Code went from Zig to Rust people were accusing the developer of doing it as a PR stunt, only I knew it was not, its insanely trivial to port projects using Claude, I had done it months prior, I took a C# project from 2009... had Claude go file by file, write up docs, and port it all to Rust. It had its bugs and quirks, but the insane amount of it that actually worked was impressive. I was also able to add new things that the old code base didn't have, including additional SQL databases, the original only supported MySQL.

I think it took me maybe a week or two tops?

So yeah, this is unsurprising, I've debated porting a few different projects I love to Go or Rust similar to this endeavor but doing both Rust and Go seems excessive to me.

Bun, I think Claude Code is still JavaScript or TypeScript
Bun is what hosts Claude Code, Bun was Zig, now its Rust, but yeah I guess I wrote CC instead of Bun.
> Bun is what hosts Claude Code

What? I'm not sure you know what you're talking about

Claude Code runs on Bun, it's why Anthropic bought Oven. Maybe you should research the facts before making comments like these.
I'm aware of that. "Bun hosts Claude Code" is a nonsensical sentence. Bun is a JS runtime. It doesn't "host" anything.
There's a lot wrong with your comment. First, Claude Code was and still is a TS/JS application. Bun, its runtime, went from zig to rust. However the javascript engine is still C++.

Second, Taylor Otwell very clearly claims that these new Rust and Go versions aren't slop ports of Laravel (his words). They're implemented from scratch.

Third, why would doing both Go and Rust be excessive? There is no value in changing the language of a framework to begin with, because the framework is tied to the language by design. So the only reason to reimplement it is to attract developers from the new language. And if it's as easy as you claim to create such port, then why wouldn't they want to attract both Go and Rust developers??

> First, Claude Code was and still is a TS/JS application. Bun, its runtime, went from zig to rust. However the javascript engine is still C++.

Correct, I misspoke when I meant to say Bun, that's on me.

> Second, Taylor Otwell very clearly claims that these new Rust and Go versions aren't slop ports of Laravel (his words). They're implemented from scratch.

He did it in 8 weeks with AI, I'm not calling it Slop, but just want to be very clear that AI was definitely involved, which is what I'm suggesting is that the right developer paired with an AI model can port a project they're familiar with to a new language. I've spent most of my career involved in total rewrite projects, they don't just happen in 8 weeks, with a single developer.

> Third, why would doing both Go and Rust be excessive? Instead of focusing on one single instance of Laravel, or even two now he's focusing on three renditions of it, it's a bit of mental overhead to manage and maintain something that could be so critical to many businesses.

I do love this initiative either way, both Go and Rust in my eyes need something like Laravel, I never found something quite like a Laravel in either, there's some close ones in Rust, but they're not adopted industry wide as far as I can tell.

"It wasn't a PR stunt, they were just trying to show how impressive their product is"
Except me and others have already done what he clearly did because it became pretty obvious to anyone paying attention to Zig that Zig was becoming friction on their efforts that wasn't there had they been using literally any other language.