3 ms·
Seems really cool - I’d love to know more about how this works. Are there some c bindings or something that lets us call a rust program from php? It sounds lik
by fideloper 3y ago
Seems really cool - I’d love to know more about how this works. Are there some c bindings
or something that lets us call a rust program from php?
It sounds like the actual async features come from Revolt so I’m not 100% sure where Rust fits in. Because the rust lib used is async as well, they’re compatible?
- danogentili 3y agoThe PHP <-> Rust bindings are provided by https://github.com/Nicelocal/ext-php-rs/ https://github.com/Nicelocal/ext-php-rs/ (our fork of https://github.com/davidcole1340/ext-php-rs https://github.com/davidcole1340/ext-php-rs with a bunch of UX improvements :). php-tokio's integrates the https://revolt.run https://revolt.run event loop with the https://tokio.rs https://tokio.rs event loop; async functionality is provided by the two event loops, in combination with PHP fibers through revolt's suspension API (I could've directly used the PHP Fiber API to provide coroutine suspension, but it was a tad easier with revolt's suspension API (https://revolt.run/fibers https://revolt.run/fibers), since it also handles the base case of suspension in the main fiber).
- joe_hoyle 3y agoI’m one of the few contributors to ext-php-rs. I’d be interested in contributing to your fork if you are planning to support your fork too. I think there’s a lot of QOL improvements to be made still and also adopting newer php features etc
- danogentili 3y agoThat would be awesome! Yes, I'm planning to support my fork of ext-php-rs, given that it will be heavily used by our mongodb driver. I've actually sent an email to David Cole, asking him to make a maintainer of the original repo, but he hasn't replied yet, feel free to send your MRs to our fork in the meantime!