Live data from Hacker News

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

yekdeveloper.com

41–50 of 158 posts

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

#41
I'm starting to build a bit of antagonism to all-encompassing frameworks (e.g. Spring, Larvel, Phoenix, etc.), because while they are productive to build new things with, I seem to always have the same issue on legacy projects built with them.

It always seems to be a challenge to upgrade dependencies for these projects. Its usually because (in building the thing) one can't fully follow the "prescribed" way of doing things with the god framework, because each project has to deal with a niche infrastructure environment and/or business context that requires some hack or additional dependency. Then when you need to, say, upgrade a language version, you can't follow the god framework's guide for doing this (if there even is a decent one) because it will break your workaround. So you end up with this hodgepodge which never gets updated until it reaches a critical point where it cannot continue to run on your infrastructure, and it forces a big migration project.

Using a selection of libraries to build up the elements of a web service, and creating your own high-level abstractions for utilizing them, does require an additional time investment, but it leaves you in more control to do upgrades piece by piece, and to pivot the way things work when it is needed.

I feel like the Go ecosystem follows the latter approach more than most, and it was bit of a mindset shift for me at first, but I've grown to appreciate it.

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

#42
post #26

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…

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

And still nobody outside of Meta cares about hack.

The niche I think PHP had back in the day has largely been supplanted by Python.

Maybe it’s better now, but after moving on from it to basically anything else after a 25 year career, I don’t miss it.

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

#43
I do this with Perl.

One of the reasons I like Perl is because of its high committment to backwards compatibility.

I like PHP because it's so easy to set up an installation of my app, but the breaking changes have bit me hard in the past, so I try to minimize its use.

Together, it's a great combo.

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

#44

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.

In https://github.com/timschmidt/alumina-ui I've been building for WASM using the egui toolkit which just accepts an HTML canvas the size of the browser and starts shouting WebGL at it.

I get to forget about HTML and Javascript, CSS, most of the complication of the browser and web, and just write an application in my favorite language which will run fast and deliver GL accelerated graphics to it's users.

I am really happy with WASM / WebGL for being abstractions which allows for this.

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

#45

I'm starting to build a bit of antagonism to all-encompassing frameworks (e.g. Spring, Larvel, Phoenix, etc.), because while they are productive to build new things with, I seem to always have the same issue on legacy projects built with them. It always seems to be a challenge to upgrade dependencies for these projects. Its usually because (in building the thing) one can't fully follow the "prescribed" way of doing t…

Yep, In my domain only Go/Rust are useful. The opinionated framework culture never fits the bill. I think Rails/Laravel/Django are great when you have a beaten path for relational DB crud.

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

#46
post #5

> In short, the modern PHP ecosystem gives us the best of both worlds: the ability to build quickly and confidently in PHP, while still having powerful options (C, Rust, Go) for performance-critical parts. This hybrid approach lets us stay productive without sacrificing speed where it matters most. I understand this for a large codebase where rewriting is not feasible. But if that wasn't the case, a C# APIs achieves…

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.

Completely agree. I don't work much in PHP anymore, but there's still nothing that's faster or easier to get something up and running. I use it for web services, and command line scripts when I just need something fast.

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

#47

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…

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 c…

> I think you really have to decide based on the complexity you need

I don't really agree. I think the goal should be to reduce complexity where possible, but not if you're inevitably painting yourself into a corner.

If you want the simplest and most scalable way forward, write static pages and avoid server-side rendering.

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

#48
post #42
post #26

Earlier quoted context omitted.

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

And still nobody outside of Meta cares about hack. The niche I think PHP had back in the day has largely been supplanted by Python. Maybe it’s better now, but after moving on from it to basically anything else after a 25 year career, I don’t miss it.

I'm not sure what point you're trying to make by mentioning Hack.

At this point it's diverged from PHP to the point that it's basically a different language, is (IIRC) actually slower than PHP 8, and the HHVM doesn't even support PHP any more.

As such, it's not a huge surprise that relatively few people outside of Meta give it much attention.

I also moved on from PHP several years ago, and don't miss it. That doesn't mean I don't recognise that there are still perfectly legitimate reasons to choose it.

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

#49
post #23

Earlier quoted context omitted.

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.

There's a firm foundation in Javascript. The choices aren't choices I'd make but they're choices I understand. Brendan Eich knew what he was doing and it shows, indeed if it was made simply of bailing wire and string it'd have been replaced. For PHP on the other hand - even when I started writing PHP3 - so certainly not the very beginnings, it's clearly just cobbling together whatever works from unrelated half-unders…

Do we need to post that JS' weird things link here? Of the basics of JS, few things are sound. The "firm foundation" idea doesn't really work for JS. It might even work better for PHP, and I am saying that as someone, who doesn't want to do PHP ever again.

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

#50

Earlier quoted context omitted.

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 c…

> I think you really have to decide based on the complexity you need I don't really agree. I think the goal should be to reduce complexity where possible, but not if you're inevitably painting yourself into a corner. If you want the simplest and most scalable way forward, write static pages and avoid server-side rendering.

How would you be painting yourself into a corner with PHP more than with JS? If you use PHP, you can just serve/use JS later. But if you use JS, you will have a hard time serving HTML from PHP later. Aside from both languages kinda being painting oneself into a corner, I don't see how one would do more so with PHP than with JS, out of all the things.
Post reply on HN