Readit News logoReadit News
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
pancsta · 2 days ago
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).
avan1 · 2 days ago
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.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
sneak · 2 days ago
Go, naturally.
avan1 · 2 days ago
Perfect. we wrote our gateway in Go which handle authentication as well and then pass users data to other services (Go and php) and return their responses.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
77pt77 · 3 days ago
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.

avan1 · 2 days ago
author here. thanks for reading my post. i didn't suggest php for all type of projects. i don't choose that myself. what i just mentioned if the only reason to choose something else for responding some apis faster you still may continue in php for that.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
sublinear · 3 days ago
This sounds absolutely disgusting to maintain. Where are you going to hire devs that want to work on crap like this?
avan1 · 2 days ago
as i mentioned we just choosed frankenphp which is officially supported by php foundation. also only less than 5 percent of our code base is in Go. i don't see any problem to hire developers.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
colesantiago · 3 days ago
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 unmaintainable mess of a codebase.

avan1 · 2 days ago
i don't recommend rewrite in anycase (had done 2 successful rewrite before but still i don't choose that my self) and new php run times can may be really fast. you can checkout benchmarks. swoole for instance if used with all the functionalities like its specific caches may be so fast (in some cases as fast as Go)
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
sneak · 3 days ago
When I do stuff like this, I just write the front app in the new/fast language, then reproxy the stuff not written in the fast language to the legacy app. You can even add middlewares or caching or metrics in the new app for requests going to the old one, as you can run (fast) code around both the request and the response.

It’s the best of both worlds - the new app gets to see all of the traffic, but doesn’t need to implement 100% of the routes. Any added to the new app can just take precedence over the old one, carving out the path-space that gets reverse proxied.

It seems like doing FFI for this is overly complex; I’d rather take the small perf hit of doing another request to a different process.

avan1 · 2 days ago
good idea, which language you choose for that ? also with frankenphp you can just write those required apis to be really fast as go extensions.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
preinheimer · 3 days ago
Reminds me of how Yahoo! worked back in the day. All their display logic in PHP, with the hard business logic in c extensions.
avan1 · 2 days ago
if you know more about it, i would glad to hear which extension they did developed for business logic. i used a lot of Yahoo! in back days.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
conceptme · 3 days ago
The complexity with debugging and maintenance seem to be overlooked, if you have the option don't do this.
avan1 · 2 days ago
thanks. but may you explain more. we just choosed frankenphp but i did't see if it makes debugging it much worse.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
klaussilveira · 3 days ago
Pasir is like frankenphp, but in Rust. Very promising, but still early in development:

https://github.com/el7cosmos/pasir

Which uses the following Zend API bindings for Rust:

https://github.com/davidcole1340/ext-php-rs

There's also all sorts of interesting experiments, like ngx-php, which basically embeds PHP via Zend API inside an nginx binary: https://github.com/rryqszq4/ngx-php

And workerman, which has a hybrid backend of asio libraries, so you can get pretty fast runtimes: https://github.com/walkor/workerman

avan1 · 2 days ago
thanks for suggestion. looks cool. but as you said far from production ready. we choosed frankenphp since we saw it got support by php foundation.
avan1 commented on The Rise of Hybrid PHP: Blending PHP with Go and Rust   yekdeveloper.com/p/4-the-... · Posted by u/avan1
1a527dd5 · 3 days ago
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.

avan1 · 2 days ago
4 years ago we have been in same situation and we choosed to continue in php with choosing version 8. so far it works for us all these years.

u/avan1

KarmaCake day70February 13, 2020View Original