Live data from Hacker News

The Rise of Hybrid PHP: Blending PHP with Go and Rust

yekdeveloper.com

131–140 of 158 posts

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#131

Joined {{company}} when everything was using 5.4, there was a big distaste of PHP back then. But as PHP have released newer versions I'm convinced our migration away from PHP (which is just finishing) is probably a step backwards _now_ that PHP is awesome. Everyone still thinks it is like 5.x days, it really isn't.

> now that PHP is awesome.

It's definitely better, but awesome? That's a huge stretch.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#132
post #11

I bit the bullet rewriting my app from PHP to Go and it paid off for my company, we're talking 20K lines of PHP code, reduced to 4K lines of Go and with the added efficiency gains with it. I think some orgs just need to take the jump and plan a rewrite, add tests (easier with Go) and just do this if they are a PHP shop, I would say it's worth it. Instead of blending Rust/PHP or Go together and having an unmaintainabl…

How did you reduce LoC with a move from PHP to go? Go is a pretty verbose language, whereas for me PHP is somewhere in the middle of the pack in terms of verbosity (Haskell would be on the terse side, enterprise Java and Go on the verbose end, particularly due to the constant error-checking after every function call).

Maybe they mean with dependencies? There are some bloated libraries out there but because PHP is a dynamic language, the bloat only matters if it’s in your hot path.

But I would say a 20k line PHP app is pretty small… we probably have 20 different 1k+ files in our app. They’re not pretty but they’re still fast enough and they work so I’m not gonna try and rewrite them just for giggles.

That said, when working on this legacy behemoth, it’s not uncommon we find a way to delete a few hundred lines because there are so many old features that aren’t needed by the business anymore so we can remove that cognitive load from codebase. Maybe that had a similar experience and the rewrite was just a good time to get buy in from the business to admit that the features weren’t important anymore. We run an e-commerce site so there are lots of little marketing experiments cluttering the app and it’s a constant churn to remove old ones and add new ones for people to tweak and test with feature flags. Removing dead code is just a part of the job.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#133

Earlier quoted context omitted.

The reason Go does not have a grand framework is that the language has a severely underdeveloped type system, which makes building complex libraries that meaningfully complement each other overly difficult. I waited nine years before starting on my first Go database toolkit so I could use generics. I succeeded, but can't shake the feeling that I know I had a better experience doing it with Java in undergrad. Being ab…

> The reason Go does not have a grand framework is that the language has a severely underdeveloped type system Counterpoint: PHP. PHP 5.3 had an even less capable type system, but developed several usable frameworks.

PHP has fully looped back around and have a more capable type system than Go or even JS or Python. It took a long time, but it got there and it did it pretty competently.

In the past it got away with it because of PHP magic. PHP let's you do pretty much whatever, at least in the past.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#134

Earlier quoted context omitted.

Having been in the C# world for a long time, and the various web/api frameworks. PHP is really nice if you dig into it, it includes so many great functions and functionality built in for creating web stuff. It also has a number of issues,. but to quikly put something together PHP take the win in my limited opnion.

The only reason PHP still exists is because of shared hosting companies and Wordpress. PHP’s initial appeal was you could do scripting on the server side, “turn off PHP with a ?>” spit out normal html, and “turn back on PHP with a For a beginner programmer, it was simple, easy to understand, and had an include so your designs were’t nested table hairball messes of garbage. (but your CSS was definitely garbage). Today…

PHP has a much more competent type system than JS and is overall more ergonomic IMO.

Typescript exists, but if I'm compiling something I'm using a real language or framework like dotnet. There's no reason for me to use typescript and node and install 100 packages when I can just install dotnet.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#135
post #38
post #33

Earlier quoted context omitted.

I'm not so sure: If you think about hiring talent, there's a perception in the wider industry about PHP (rightly or wrongly, let's not debate that here) that'll prevent access to a lot of great developers. So even if not warranted anymore on technical merits anymore, in terms of employer branding, I'd say migrating away from PHP is helping.

Right on, I wrote a lot of PHP 15 years ago and I swore I’ll never get back to it. I’m a much better developer now and I’ll actively avoid any company doing PHP in 2025.

PHP is a very different language than 15 years ago, and large applications are pretty much indistinguishable from Java or dotnet. The type system is more cohesive than JS or even Python at this point.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#136
post #52
post #15

The one thing I don't like about PHP is that the whole application is bootstraped (and autoloading and the configuration is re-evaluated) in every single http request. Sure thing there's cache and all, but it just doesn't feel right (compared, to, for instance, an http server written in golang)

This is one of the best things about PHP IMO. It makes it very easy to scale out.

It also makes it much easier to debug and forces the complexity down.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#137
post #66

The fact that we're still pretending PHP is a valid solution for almost anything after all these years is a joke. Not only that, but now we have these "frankenstein" solutions with all the interop problems on top of PHP. Just shows that as a species humans really can't learn.

PHP really isn't that different from Ruby or Python these days. But, I can see the perspective where none of those 3 are valid solutions given newer better options like NodeJS and Rust.

NodeJS is, like, 10 steps back from PHP 8. Worse type system, less safe, package ecosystem is a hot mess, slower... I mean the list goes on and on.

We can "lipstick pig" a lot of those problems by using typescript or whatever, but now we're compiling JS and the output isn't even fast. At that point use a competent compiled language like C# or Rust.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#138

Earlier quoted context omitted.

PHP really isn't that different from Ruby or Python these days. But, I can see the perspective where none of those 3 are valid solutions given newer better options like NodeJS and Rust.

NodeJS is, like, 10 steps back from PHP 8. Worse type system, less safe, package ecosystem is a hot mess, slower... I mean the list goes on and on. We can "lipstick pig" a lot of those problems by using typescript or whatever, but now we're compiling JS and the output isn't even fast. At that point use a competent compiled language like C# or Rust.

As someone who is not a fan of npm/ts I must say I find this almost delusional.

TS is way better than PHP and node is much faster.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#139

Earlier quoted context omitted.

The only reason PHP still exists is because of shared hosting companies and Wordpress. PHP’s initial appeal was you could do scripting on the server side, “turn off PHP with a ?>” spit out normal html, and “turn back on PHP with a For a beginner programmer, it was simple, easy to understand, and had an include so your designs were’t nested table hairball messes of garbage. (but your CSS was definitely garbage). Today…

PHP has a much more competent type system than JS and is overall more ergonomic IMO. Typescript exists, but if I'm compiling something I'm using a real language or framework like dotnet. There's no reason for me to use typescript and node and install 100 packages when I can just install dotnet.

install dotnet, and install 100 packages for .net core, asp.net, identity, ef, etc. Don’t kid yourself.

While strongly typed languages are great. I like to be able to get things done. This is why I don’t C++ anymore. This is also why I don’t dotnet anymore. Too much BS with the type system and correctness and the Microsoft way or lack of support or rug pull. They lost me when they killed XNA.

Typescript is actually good, except for the fact that it’s a transpiler to JavaScript. That part sucks.

I want a C++, with Types, with memory safety, with garbage collection, with pointers, with a dev experience like dotnet, but we don’t have those things.

Re: The Rise of Hybrid PHP: Blending PHP with Go and Rust

#140

Earlier quoted context omitted.

Got it, you don't care about how the sausage is made. That's totally fine.

It doesn't sound like this is what redwall_hp meant; it sounds like what they meant was that pixels are the wrong level of abstraction. If so, I agree: the web is about marked-up text. When you break it down to the very basics, what you get is a teletype, not raster.

I'd say that is more like a terminal than a browser. Regardless, what I really mean is some data is needed for the pixels (or whatever abstraction you want above that). You don't need data for anything other than the current viewport and whatever is likely needed next. No less, no more. No over or under fetching. This would be much better imo.
Post reply on HN