NetherGamesMC / PHP-Quiche

A Quiche-based QUIC implementation for PHP using FFI
BSD 2-Clause "Simplified" License
11 stars 1 forks source link

Hey and FFIMe #1

Closed bwoebi closed 7 months ago

bwoebi commented 8 months ago

It's cool to see that you ended up using FFIMe, which I've been maintaining recently :-)

I don't know if you're aware of https://github.com/amphp/quic which I've recently implemented using FFIMe as well, but it's tailored to the amphp ecosystem with its event loop and suspensions. So it's nice to see other implementations of it too!

By the way, I do recommend committing the generated bindings, to avoid relying on the stability of FFIMe. I don't think APIs will change, but still, generated code is immutable. For that, to ensure the generated code works across linux and mac, I've added capabilities to FFIMe to inspect which functions are actually used as well as also restricting the generated bindings to specific symbols https://github.com/amphp/quic/blob/2dd513e0b4bd82e1810a52cabb8604829cdfb03f/src/bindings/generate.php. Together it gives a minimal set which just works cross-platform. I should probably document that on FFIMe :-)

I'm also curious to hear if there were specific difficulties in using FFIMe / getting it set up.

dries-c commented 8 months ago

Thanks for reaching out, I found out about the repo midway through the project. However I wasn't a fan of the amphp ecosystem so I continued.

To my knowledge, FFIMe and FFIgen are the only options available to avoid manual code writing. Considering FFIgen is based on FFIMe but is less mature, I went with FFIMe.

Regarding the generated bindings, they currently allow users to integrate their own Quiche binaries. However, if I were to make the generated code immutable, I'd need to supply the static binaries with it. This would necessitate updating versions whenever Quiche updates even if it was BC.

FFIMe kinda explained itself to me, haven't had much difficulty getting it running.