Frequently Asked Questions

What is AMPHP?

AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. amphp/amp is the core package providing futures and cancellations. With AMPHP v3 the event loop moved to its own organization in collaboration with the ReactPHP team and others, which is now known as Revolt.

When should I use AMPHP?

AMPHP is always useful if you have I/O-bound tasks that can run concurrently, e.g. making two HTTP requests concurrently instead of sequentially and operating on the result of both. Such I/O-bound tasks include WebSocket servers and chat bots.

Why should I use AMPHP over other solutions like ReactPHP?

AMPHP makes asynchronous code more readable with first-class fiber support instead of promises and then-chains and generally has more focus on performance. However, there's no reason to lock into either of these ecosystems, because they're fully compatible! You can use amphp/react-adapter for AMPHP v2 and revolt/event-loop-adapter-react for AMPHP v3 and choose any library from the ReactPHP, AMPHP, or Revolt ecosystem.

How can I contribute?

Everyone can help. To get started, there are open discussions on GitHub you can contribute to. Found something you could work on? Comment and open a pull request. Missing a specific package that isn't async compatible? Write it. Have feedback? Great!