Amp is a non-blocking concurrency framework for PHP that provides futures and cancellations as primitives for asynchronous programming.
Amp solves the problem of PHP's traditional sequential execution model, where I/O operations block the entire process while waiting for responses. Instead of sitting idle during database queries or API calls, Amp enables concurrent execution of independent operations. The framework leverages PHP 8.1 fibers to write asynchronous code with the same structure as synchronous code, avoiding the complexity of callbacks or generator-based coroutines. Fibers have their own call stacks but are cooperatively scheduled by an event loop, allowing multiple operations to interleave. The `Amp\async()` function runs operations concurrently, and `Future::await()` retrieves results when needed. Non-blocking I/O libraries prevent any single operation from blocking the entire process.
Amp suits applications that perform multiple I/O operations and need to avoid blocking delays, such as services making concurrent database queries or API calls. It works best for developers comfortable with PHP 8.1 and willing to adopt fiber-based concurrency patterns. The framework avoids the "what color is your function" problem that plagued earlier PHP concurrency approaches by allowing asynchronous and synchronous code to coexist naturally. Amp delegates event loop implementation to Revolt, a separate package that handles the actual scheduling of fibers.
The project maintains active engagement with its ecosystem, providing multiple packages that build on the core futures and cancellations primitives. Development focuses on keeping the cognitive load low by using fibers to eliminate callback-heavy patterns. The framework emphasizes non-blocking I/O throughout its library ecosystem, ensuring that adopting Amp encourages proper concurrent patterns across dependencies.