Skip to content
CAI
Software that uses CAICheck a score

amphp/amp

70.4

Strong · 19 September 2026

1.7k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a non-blocking concurrency framework for PHP 8.1+ that provides asynchronous primitives such as Futures, cancellation tokens, and timers. It replaces legacy event reactor implementations with the Revolt event loop and fiber-based execution to manage concurrent operations. The library offers utilities for awaiting multiple asynchronous tasks and handles resource management through a standardized interface.

Features

Introduces new cancellation, future, and async primitives

The src directory now provides a comprehensive set of asynchronous primitives: a Cancellation interface with implementations for composite, deferred, signal, timeout, and null cancellations; a Future class with a fluent interface (map, catch, ignore) and iteration support; a DeferredFuture for resolving futures; a Closable interface for resource management; an Interval class for repeating timers; and an async() function to run closures in fibers. These changes introduce new capabilities for managing asynchronous operations and cancellation, replacing previous mechanisms.

src · high confidence

Removals

Removed event reactor components

The event reactor subsystem has been removed from the Alert package. This includes the deletion of the Reactor interface, the ReactorFactory that selected between implementations, and the two concrete implementations: LibeventReactor (which used the libevent extension) and NativeReactor (which used PHP's stream\_select). Users can no longer schedule timers, watch streams, or run event loops using these classes.

src/Alert · high confidence

Behavioural changes

Improved error tracking for unhandled futures and new utility functions

Unhandled future errors now include the creation location of the future when assertions are enabled and AMP\_DEBUG is set, providing clearer debugging information for unawaited futures. Additionally, new utility functions awaitFirst, awaitAny, awaitAnyN, awaitAll, and await have been added to simplify common patterns for waiting on multiple futures, including options to ignore errors or wait for specific counts of successful completions.

src/Future · high confidence

Major version 3.0.0: Migration to Revolt event loop and PHP 8.1 fibers

This release introduces a breaking architectural shift for version 3.0.0, replacing the previous \Amp\\Loop\ event loop implementation with the external \Revolt\ event loop and requiring PHP 8.1 or later to leverage native fibers. The core asynchronous primitives have been redesigned: the \Promise\ class is replaced by \Future\, and the previous generator-based coroutine system (using \Amp\\call\, \Amp\\coroutine\, etc.) is removed in favor of fiber-based concurrency via \Amp\\async()\. Consequently, \Amp\\Promise\\wait()\ is replaced by \Future::await()\, and timer intervals now use seconds (\float\) instead of milliseconds (\int\). The namespace has been standardized to \AsyncInterop\ (specifically \Amp\), and various classes and functions have been renamed or removed, such as \Deferred\ becoming \DeferredFuture\ and cancellation tokens becoming \Cancellation\. The project structure has also been cleaned up, removing the legacy \autoload.php\ and updating configuration files like \.editorconfig\, \phpunit.xml.dist\, and \psalm.xml\.

(repo-wide) · high confidence

Refactor internal cancellation and future state management

The internal implementation of cancellation and future handling has been refactored to use a dedicated \Cancellation\ interface and \FutureState\ class, replacing previous \callable\ type hints with strict \\\Closure\ types. This change introduces new internal classes (\Cancellable\, \FutureIterator\, \FutureIteratorQueue\, \WrappedCancellation\) to manage subscription IDs, event loop queuing, and unhandled error tracking. Additionally, the codebase now enforces strict typing, readonly properties, and forbids cloning/serialization on internal state objects, while also fixing PHP 8.5 deprecation warnings by using \str\_increment()\ for ID generation.

src/Internal · high confidence

Updated examples to use Amp library and removed legacy Alert reactor demos

The examples directory has been refreshed to demonstrate the Amp asynchronous library instead of the legacy Alert reactor. New examples (async.php, cancellation.php) show how to use Amp's async execution and cancellation features, while old examples (basic\_run.php, native\_vs\_libevent.php, scheduling.php) that relied on Alert's ReactorFactory and specific reactor implementations have been removed.

examples · high confidence

Test coverage

Added test coverage for Future await combinators and iteration; Added tests for Interval, WeakClosure, and test utilities; Added tests for cancellation token implementations; Removed unit tests for LibeventReactor, NativeReactor, and ReactorFactory.

Dependencies

Migrate to amphp/amp with PHP 8.1 requirement

The package has been renamed from rdlowrey/alert to amphp/amp, shifting from a generic event-loop description to a non-blocking concurrency framework. The minimum PHP version has been raised from 5.4 to 8.1, and the library now depends on revolt/event-loop (versions ^1 or ^0.2). Development tools have been updated to PHPUnit ^9 and Psalm 6.16.1, and the namespace has changed from Alert to Amp with PSR-4 autoloading.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 70.

Lenses

  • Code Health 100
  • Architecture 100
  • Maturity 55
  • Readiness 71
  • Security 95

Changes since last survey

  • 300 commits — 253 feature/other, 47 fixes

By area

  • (root) — 51 commits
  • lib/Internal — 36 commits
  • lib/Loop — 18 commits
  • src/Internal — 16 commits
  • .github/workflows — 15 commits
  • src/functions.php — 15 commits
  • lib/functions.php — 13 commits
  • lib/AsyncGenerator.php — 12 commits
  • test/Future — 12 commits
  • lib/Future — 8 commits
  • src/Future.php — 8 commits
  • examples/pipeline — 6 commits
  • src/Future — 6 commits
  • test/Cancellation — 6 commits
  • (repo) — 5 commits
  • lib/Future.php — 5 commits
  • src/CompositeCancellation.php — 5 commits
  • test/Pipeline — 5 commits
  • docs/futures — 4 commits
  • lib/CombinedCancellationToken.php — 3 commits

Notable commits

  • fix: Fix CompositeCancellation not reporting cancellation until next tick
  • fix: Fix CompositeCancellation when two are cancelled
  • fix: Fix CompositeCancellation::isRequested() and throwIfRequested()
  • fix: Fix Future iterator abandonment
  • fix: Fix NativeDriver when only signals are enabled
  • fix: Fix Psalm errors
  • fix: Fix TypeError in EventDriver (#339)
  • fix: Fix weakClosure() not preserving original scope (#393)
  • fix: Fix active watchers in some tests
  • fix: Fix all() with iterable
  • fix: Fix await example (#411)
  • fix: Fix circular reference on exceptions
  • fix: Fix code style
  • fix: Fix code style
  • fix: Fix code style
  • fix: Fix detection of AMP_DEBUG
  • fix: Fix directory in psalm config
  • fix: Fix documentation in CancellationToken
  • fix: Fix documentation in CancellationTokenSource
  • fix: Fix emit after disposal
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

amphp/amp was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 73c38b323ff8d790abf0f76c56fcc892bda4111a — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.