Live data from Hacker News

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

yekdeveloper.com

21–30 of 158 posts

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

#21
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 things I do like about PHP.

Intrinsically minimized state (to a certain degree).

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

#23

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 might have a bad reputation but I honestly don’t think JavaScript is a better language in real world terms.

I do get why JS appeals to people, but switching from PHP to JS feels a little winning an internet argument — you might feel smarter for doing so but in reality all you’ve done is sunk time into something that doesn’t make you any better off.

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

#24

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…

I fail to see how you got 5x lower loc from php to go.

Php isn't perfect but it has a lot of shortcut syntaxes that go just doesn't have

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

#25

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…

I'm not a huge fan of PHP, but for simple sites I think you way underestimate the power and simplicity. It feels old compared to jsx approach, but old doesn't always mean bad. I've increasingly returned to the template rendering model pioneered by PHP and for sites that aren't full blown apps, it is a lot simpler which means faster iteration and reduced cognitive load. I think you really have to decide based on the complexity you need

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

#26

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…

> The only reason PHP still exists is because of shared hosting companies and Wordpress.

Unfortunately I can't think of anything constructive to say about this nonsense.

> Today, it’s so easy to run JavaScript, I can build a basic jsx site in under an hour, just like I can with PHP and includes.

You assume people agree that it's preferable to work in JavaScript.

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

#28
Very curious what sort of workloads are being talked about here that have the intensity that have C or Rust or Go extensions are necessary? I can certainly believe they exist but I'd be really interested to find out more and why it makes sense to add this complexity into the stack and not solve in other ways.

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

#29
Sometimes I think we should go back to basics: pixels, data, latency / bandwidth. The web is an optimization problem in the sense that we want to render correct pixels at perceptual speed given latency and bandwidth constraints.

It should be more like: what pixels is the user about to see? What data is need to set the the pixels? What data is likely needed next and optimistically pre-fetch - something like that.

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

#30
post #12

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…

Surprised you made it more compact and not have it turn into 40k lines of if err! = nil Ive done do rewrites of stuff in python and it gets really verbose, plus dependency injection patterns for testing.

A ton of stuff in PHP is mostly templating + DB calls for a lot of websites.

If you combine Go + Templ for instance, your "if err" are mostly on the DB calls. What you needed to check in PHP anyway.

Yes, the if err != nil is extreme frustration when your doing for instance, type conversion. But if your already doing this with reflection in your DB calls (by casting to the correct types in your struct), that saves a ton.

Same with getting external data, casting it directly to structs and if something is wrong, its a single "if err".

And if your just doing PHP style programming in Go, well, _, ignoring errors like PHP does and you can panic/recover to make Go act as badly as PHP, to save on the "if err". ;-)

Post reply on HN