Documentation Packages Getting Started FAQ Support

FAQ - Frequently Asked Questions

What is Amp?

Amp is a concurrency framework for PHP providing primitives to manage concurrency such as an event loop, promises, and asynchronous iterators.

What is amphp?

Amphp is the group behind Amp maintaining it and its core components.

When should I use Amp?

Amp 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 Amp over other solutions like ReactPHP?

Amp makes async code more readable with coroutines instead of then-chains and generally has more focus on performance. But why not both? Amp is fully compatible with any ReactPHP library.

Why did you develop Amp instead of contributing to ReactPHP?

It might surprise you, but Amp isn't that much younger than ReactPHP. At the time Amp was started, ReactPHP was still very young. ReactPHP was inspired a lot by Node and thus offers a lot of callback based APIs. Amp follows a different approach and uses PHP's generators to build coroutines which make async code way easier to reason about. We think then()-style promises are sub-optimal in a world with generators.

What is the status of Amp?

Amp is very stable. Its first stable version dates back to 2015 with v1.0.0. v2.0.0 is a result of the discussions in the async-interop group and the merge with Icicle, providing even better APIs for writing concurrent and even parallel code now.

Other components might not be as stable as Amp itself. If you want to know more about the stability of a specific component, just have a look at its documentation.

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!