@goetas_asmir@dunglas@asyncphp@Alli_g83 Don't let the readme frighten you.
$pool = new ContextWorkerPool();
for ($i = 0; $i < 10; $i++) {
$pool->submit(new EchoTask());
}
$pool->shutdown();
EchoTask needs to be defined in another file so it can be autoloaded in the worker, but still simple.
Thank you to our newest sponsor https://t.co/nBJKrGibIt! We really appreciate every contribution toward our efforts to bring #async#PHP forward.
Consider sponsoring AMPHP if you use it in one of your projects. Thank you to everyone who supports us!
https://t.co/CBtnPOICWv
Continuing our series of accessory libraries compatible with amphp/http-server v3 and AMPHP v3, we've tagged v2 of amphp/http-server-form-parser. 🎉
This helper library provides a utility to parse url-encoded form requests or stream large files from multipart/form-data requests. This provides functionality similar to $_POST and $_FILES for an #async #PHP HTTP server using AMPHP. 🚀
https://t.co/axu4IcSgja
On the heels of last weeks release of amphp/http-server v3, we're working to tag stable releases of the "accessory" libraries. 🛠️
First up is amphp/http-server-router using nikic/fast-route to provide routing for your application.
Incoming HTTP requests are directed to various request handlers based on their path. Routes may define parameters constrained using regex. Parameter values are available in request attributes.
https://t.co/PoWHjTAt9y
Announcing a huge milestone for the AMPHP project – the release of amphp/http-server v3.0, compatible with AMPHP v3 and fibers! 🎉
amphp/http-server provides a non-blocking, concurrent HTTP/1.1 and HTTP/2 application server for #PHP
https://t.co/DUHgsim4tV
The example above is based on hello-world.php found in the examples directory. It demonstrates the basics of wiring up a simple HTTP server replying with "Hello, World!" to each request.
@simPod_@revoltphp Apologies for the long delay in replying. We were busyupdating the docs and just about ready to tag amphp/http-server v3. We've now done that, have a look at https://t.co/lHsxcCvuMp, built on Revolt's event loop and AMPHP (https://t.co/pFOo8dqtxv, @asyncphp).
It's incredible how many smooth upgrades have been made possible through my parameter type widening change. I didn't see the potential at the time of writing the RFC, but @nikita_ppv did. Time flies!
Announcing v2.0 of amphp/parallel, compatible with AMPHP v3 and fibers! 🎉
amphp/parallel provides true parallel processing for #PHP using multiple processes or threads, without blocking, no extensions required.
Below is an example with parent and child scripts communicating.
Announcing v2.0 of amphp/socket compatible with AMPHP v3 and fibers! 🎊
https://t.co/wEsAcFFjCF
This package builds on our stream interfaces to create socket servers and client connections.
The example creates a basic HTTP server, replying with the IP and port of the client.
Calling all #PHP developers! We want to hear about your usage of @asyncphp and how it has helped you in your projects. Share your story with us and be featured on our blog!
Announcing v2.0 of amphp/dns compatible with AMPHP v3 and fibers! 🎉
https://t.co/9nqEg80EoC
The DNS package implements basic #async DNS resolution in #PHP.
Use it for resolving domain names to a host or query any DNS record type, such as MX records as in the example below.
Thanks to our new sponsor @DaniilGentili, a maintainer of @psalmphp!
We use Psalm in AMPHP and our own applications to catch bugs and improve code quality. Sponsoring AMPHP or a Psalm maintainer provides more resources to develop!
https://t.co/GDiRt482Yn
https://t.co/CBtnPOICWv
Announcing v2.0 of amphp/process compatible with AMPHP v3 and fibers! 🚀
https://t.co/krsS1Z2NUF
The process package provides #async execution and communication with child processes from #PHP.
This example pings 5 hosts concurrently in 5 separate child processes.
We've tagged v2.0 of amphp/byte-stream, providing a set of stream interfaces and composable implementations compatible with AMPHP v3 and fibers! 🎉
https://t.co/PtQtm59OEX
The script below reads a gzip stream from stdin, writing the decompressed bytes to stdout.
Announcing amphp/sync v2.0 which provides synchronization tools compatible with AMPHP v3! 🎊
https://t.co/n6aKr5TD03
Sync data access across #async coroutines in one process or share data among multiple #PHP processes! Use semaphores, channels, or a parcel as in the example.