News for hackers. Stuff that matters.
Re:PHP-Tokio – Use any async Rust library from PHP by fideloper on Monday August 28, 2023 @08:12AM (#37292841)
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?

Re:PHP-Tokio – Use any async Rust library from PHP by danogentili on Monday August 28, 2023 @09:26AM (#37293594)
The PHP <-> Rust bindings are provided by https://github.com/Nicelocal/ext-php-rs/ (our fork of https://github.com/davidcole1340/ext-php-rs with a bunch of UX improvements :).

php-tokio's integrates the https://revolt.run event loop with the 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), since it also handles the base case of suspension in the main fiber).

Re:PHP-Tokio – Use any async Rust library from PHP by joe_hoyle on Monday August 28, 2023 @12:30PM (#37296686)
I’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
Re:PHP-Tokio – Use any async Rust library from PHP by danogentili on Monday August 28, 2023 @12:37PM (#37296805)
That 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!