Live data from Hacker News

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

yekdeveloper.com

121–130 of 158 posts

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

#121
post #105

Earlier quoted context omitted.

thanks. but may you explain more. we just choosed frankenphp but i did't see if it makes debugging it much worse.

Working with 3 intersecting stacks is more complex than a single stack. Go toolchain is batteries included and coherent. Author admits to not using it bc of legacy (and preference).

author here. as i mentioned in post i said we choose frankenphp since it's already supported by php foundation and in some cases we might use Go php extensions. i know writing extensions in any language add a bit complexitiy but i believe if the extensions selected wisely they will be somehow fire and forget. for instance creating pdf files would be faster in Go than php. you can create an pdf creator extension and that extension would probebly work for a long time without any adding much effort to maintenance.

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

#122
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…

I would never use a Microsoft language since they discontinued VB6. Open Source languages are the only sane option.

And you are not using Typescript either, because it's a Microsoft language? Also .NET is open source over a decade already and c# was free and open from the beginning (Mono implementation).

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

#123

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.

To give an example, my main website is C#, I love it from a dev perspective and performance perspective. But I also have PHP on my personal server and will knock out PHP scripts for one off demo projects. I just ssh into my server, `vim projects/example.php` and it's instantly deployed as a link I can share.

There's `dotnet run` now. You can:

vim projects/example.cs

    var builder = WebApplication.CreateBuilder(args);
    var app = builder.Build();
    app.MapGet("/", () => "Hello World!");
    app.Run();
dotnet run projects/example.cs

Not the same as PHP I know, but it's close enough for me.

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

#124
post #53

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…

Web frameworks for me are one of those things that's "great until it isn't". If you're making a simple app then web frameworks can feel downright magical (like the original "Build a blog in 15 minutes with Rails" demo [1]), but for anything that gets even remotely complicated, I find that they generally just get in the way. I personally have grown to prefer the "mid-level" HTTP setups, like Express with Node.js or Ve…

[1] https://www.youtube.com/watch?v=Gzj723LkRJY

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

#125
post #123

Earlier quoted context omitted.

To give an example, my main website is C#, I love it from a dev perspective and performance perspective. But I also have PHP on my personal server and will knock out PHP scripts for one off demo projects. I just ssh into my server, `vim projects/example.php` and it's instantly deployed as a link I can share.

There's `dotnet run` now. You can: vim projects/example.cs var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); app.MapGet("/", () => "Hello World!"); app.Run(); dotnet run projects/example.cs Not the same as PHP I know, but it's close enough for me.

I'm glad it works for you but I guess that doesn't really cover the use case I was talking about because I want to have a bunch of these. As an example, I threw together a quick web hook processor, data from one service reformatted to fit another. I don't really need to spin up a whole new VPS for an endpoint that'll only be hit once or twice a week, so this is the workflow for doing that on the server I already have.

PHP:

   - vim projects/webhook.php
C#:

   - vim projects/webhook.cs
   - Assign a port number
   - Reconfigure Nginx/Caddy to serve that port number
   - Reconfigure systemd to dotnet run projects/webhook.cs on startup

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

#126

Earlier quoted context omitted.

And I don't care about pixels; I want to see structured documents. How I choose to view those is my business.

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.

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

#127

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's type system is so "dynamic" that it is very easy to build frameworks for it.

For instance, PHP allows for even function calls like this:

$language = "German";

$functionName = $language."_send_email";

$functionName("Mike", "mike_1@gmail.", "Text ...");

This sort of flexibility has its own problems and it is only possible because of the very lax type system of PHP but it is also extremely powerful when it comes to developing reusable frameworks.

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

#128

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…

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…

I think the Java stream API is amazing, and I do like that.

Not having the equivalent of hibernate level ORMs is not a disadvantage for me personally, just because I don't like ORMs - Asking chatgpt to spit out some SQL and mapping code for me and being able to tweak the actual SQL over time is preferable (but again that is just my preference).

I don't really agree with the idea that Go has an underdeveloped type system, I think its contraints lend itself to productivity in other ways. Of the various languages I've worked with, Go programs I expand have the highest chance of working the first time I run them, because the compiler and language server A) give meaningful indications of mismatched usages and B) older Go projects have a very good chance of just working, without me having to worry about getting them going with my IDE again. B is a product of the fact that they have been very conservative with the language.

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

#129
post #75

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.

Yeah, I use php colab all of the time to run numpy stuff on gpus, I learned about it in my php data science class in university. They’re basically equivalent now.

>I learned about it in my php data science class in university.

I rest my case...

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

#130
post #100

I owe a large part of my career success to PHP when I learned it back in the day. But recently I picked it up because I had to do some maintenance work and The package management experience was really, really bad. I really think there's a big opportunity for somebody to create the astral.sh for PHP. With a proper package manager, PHP can do way more than what it presently can.

What did you find bad about composer?

[deleted]
Post reply on HN