Build fast, concurrent applications with PHP

Benefit from concurrency by replacing your blocking I/O with non-blocking I/O,
or designing your system with non-blocking I/O from the ground up.

We shipped fibers in PHP 8.1 to extend its capabilities for concurrent applications.

The PHP standard library has already provided everything else we needed for years now, but it only ships the low-level building blocks. AMPHP provides higher-level libraries using non-blocking I/O under the hood. Fibers allow these libraries to just work, no matter whether they're used in concurrent or traditional contexts.

Latest Releases

  • Released on 2024-10-28 2.0.4 on GitHub

    amphp/websocket 2.0.4

    What’s Changed

    • Fixed assertion failure when interleaving control frames between continuation frames in Rfc6455FrameCompiler.

    Full Changelog: https://github.com/amphp/websocket/compare/v2.0.3…v2.0.4

  • Released on 2024-10-27 2.0.2 on GitHub

    amphp/sql-common 2.0.2

    What’s Changed

    • Fixed a memory leak due to SqlStatementPool accumulating on-close callbacks in SqlCommonConnectionPool.

    Full Changelog: https://github.com/amphp/sql-common/compare/v2.0.1…v2.0.2

  • Released on 2024-10-11 2.3.0 on GitHub

    amphp/parallel 2.3.0

    What’s Changed

    • Added LimitedWorkerPool extending WorkerPool in https://github.com/amphp/parallel/pull/205.
    • Added DelegatingWorkerPool implementing LimitedWorkerPool, which will only allow a limited number of workers to be pulled from a delegate WorkerPool instance.
    • ContextWorkerPool also now implements LimitedWorkerPool, as this pool implementation was already spawned a limited number of workers.

    Full Changelog: https://github.com/amphp/parallel/compare/v2.2.9…v2.3.0

  • Released on 2024-10-11 2.1.0 on GitHub

    amphp/postgres 2.1.0

    What’s Changed

    • Fixed type cast for numeric columns when using the ext-pgsql driver. The column value was being cast to a float, it is now cast to a string for parity with the ext-pq driver to retain value precision. (#66)
    • Added a parameter for the default transaction isolation to PostgresConnectionPool to set the default transaction level when constructing the pool.

    Full Changelog: https://github.com/amphp/postgres/compare/v2.0.0…v2.1.0

  • Released on 2024-09-05 1.1.1 on GitHub

    amphp/http-client-guzzle-adapter 1.1.1

    What’s Changed

    • Updated requirements to allow guzzlehttp/psr7@^1

    Full Changelog: https://github.com/amphp/http-client-guzzle-adapter/compare/v1.1.0…v1.1.1

  • Released on 2024-09-04 1.1.0 on GitHub

    amphp/http-client-psr7 1.1.0

    What’s Changed

    • Updated requirements to allow psr/http-message@^2
    • Replaced development dependency on laminas/laminas-diactoros with guzzlehttp/psr7

    Full Changelog: https://github.com/amphp/http-client-psr7/compare/v1.0.0…v1.1.0

  • Released on 2024-08-16 3.1.1 on GitHub

    amphp/file 3.1.1

    What’s Changed

    • Dropped support for ext-uv < 0.3.0.
    • Changed the version check for ext-uv to avoid an ext-opcache bug (see https://github.com/amphp/http-client/issues/365).

    Full Changelog: https://github.com/amphp/file/compare/v3.1.0…v3.1.1

  • Released on 2024-08-04 2.3.0 on GitHub

    amphp/sync 2.3.0

    What’s Changed

    • Fixed posix semaphore blocking thread when there is no space left on device by @azjezz in https://github.com/amphp/sync/pull/29
    • Added a buffer size parameter to createChannelPair() to specify a number of items which may be buffered in memory before back pressure is applied.

    New Contributors

    • @azjezz made their first contribution in https://github.com/amphp/sync/pull/29

    Full Changelog: https://github.com/amphp/sync/compare/v2.2.0…v2.3.0

  • Released on 2024-08-03 2.0.1 on GitHub

    amphp/redis 2.0.1

    What’s Changed

    • Fixed return type for RedistList::get() by @Bilge in https://github.com/amphp/redis/pull/96

    Full Changelog: https://github.com/amphp/redis/compare/v2.0.0…v2.0.1

  • Released on 2024-07-04 1.2.1 on GitHub

    amphp/pipeline 1.2.1

    What’s Changed

    • Fix a potential race condition when using a Queue to create a ConcurrentIterator. An Error with message “Must call suspend() before calling throw()” was thrown when a Cancellation provided to ConcurrentIterator::continue() was cancelled and the underlying Queue instance was simultaneously completed. See #22.

    Full Changelog: https://github.com/amphp/pipeline/compare/v1.2.0…v1.2.1

  • Released on 2024-06-02 2.2.0 on GitHub

    amphp/dns 2.2.0

    What’s Changed

    • Added StaticDnsConfigLoader
    • Fixed support for docker 26+ by @xtrime-ru in https://github.com/amphp/dns/pull/118

    New Contributors

    • @xtrime-ru made their first contribution in https://github.com/amphp/dns/pull/118

    Full Changelog: https://github.com/amphp/dns/compare/v2.1.2…v2.2.0

  • Released on 2024-05-10 3.0.2 on GitHub

    amphp/amp 3.0.2

    What’s Changed

    • Changed Closure(mixed...) annotation to Closure(...) to support PHPStan.

    Full Changelog: https://github.com/amphp/amp/compare/v3.0.1…v3.0.2

  • Released on 2024-04-21 5.1.0 on GitHub

    amphp/http-client 5.1.0

    What’s Changed

    • Add BufferedContent::fromJson() by @trowski in https://github.com/amphp/http-client/pull/355
    • Add Form::addNestedFields() by @trowski in https://github.com/amphp/http-client/pull/356
    • Make implicit nullable types explicit to avoid deprecation notice in PHP 8.4
    • RequestBody -> HttpContent by @ShiSHcat in https://github.com/amphp/http-client/pull/358

    New Contributors

    • @ShiSHcat made their first contribution in https://github.com/amphp/http-client/pull/358

    Full Changelog: https://github.com/amphp/http-client/compare/v5.0.1…v5.1.0

  • Released on 2024-04-21 3.3.1 on GitHub

    amphp/http-server 3.3.1

    What’s Changed

    • Made implicit nullable types explicit to avoid deprecation notice in PHP 8.4
    • Typo in README.md by @tncrazvan in https://github.com/amphp/http-server/pull/361

    New Contributors

    • @tncrazvan made their first contribution in https://github.com/amphp/http-server/pull/361

    Full Changelog: https://github.com/amphp/http-server/compare/v3.3.0…v3.3.1

  • Released on 2024-04-21 2.3.1 on GitHub

    amphp/socket 2.3.1

    What’s Changed

    • Make implicit nullable types explicit to avoid deprecation notice in PHP 8.4.

    Full Changelog: https://github.com/amphp/socket/compare/v2.3.0…v2.3.1

  • Released on 2024-04-19 2.0.1 on GitHub

    amphp/cache 2.0.1

    What’s Changed

    • Make implicit nullable types explicit to avoid deprecation notice in PHP 8.4.

    Full Changelog: https://github.com/amphp/cache/compare/v2.0.0…v2.0.1

  • Released on 2024-04-19 2.0.3 on GitHub

    amphp/process 2.0.3

    What’s Changed

    • Make implicit nullable types explicit to avoid deprecation notice in PHP 8.4.

    Full Changelog: https://github.com/amphp/process/compare/v2.0.2…v2.0.3

  • Released on 2024-04-19 2.1.0 on GitHub

    amphp/php-cs-fixer-config 2.1.0

    What’s Changed

    • Add nullable_type_declaration_for_default_null_value to the default rules by @alexandre-daubois in https://github.com/amphp/php-cs-fixer-config/pull/8

    New Contributors

    • @alexandre-daubois made their first contribution in https://github.com/amphp/php-cs-fixer-config/pull/8

    Full Changelog: https://github.com/amphp/php-cs-fixer-config/compare/v2.0.1…v2.1.0

  • Released on 2024-04-03 2.1.1 on GitHub

    amphp/http 2.1.1

    What’s Changed

    • Security: Fix Denial of Service via HTTP/2 CONTINUATION Frames by @kelunik

    References

    • https://github.com/amphp/http/security/advisories/GHSA-qjfw-cvjf-f4fm
    • https://kb.cert.org/vuls/id/421644

    Full Changelog: https://github.com/amphp/http/compare/v2.1.0…2.1.1

  • Released on 2024-03-21 1.1.1 on GitHub

    amphp/parser 1.1.1

    What’s Changed

    • Make implicit nullable types explicit by @nicolas-grekas in https://github.com/amphp/parser/pull/6

    New Contributors

    • @nicolas-grekas made their first contribution in https://github.com/amphp/parser/pull/6

    Full Changelog: https://github.com/amphp/parser/compare/v1.1.0…v1.1.1

  • Released on 2024-03-21 3.2.1 on GitHub

    amphp/hpack 3.2.1

    What’s Changed

    • Make implicit nullable types explicit by @nicolas-grekas in https://github.com/amphp/hpack/pull/16

    Full Changelog: https://github.com/amphp/hpack/compare/v3.2.0…v3.2.1

  • Released on 2024-03-19 2.0.0 on GitHub

    amphp/rpc 2.0.0

    Stable release compatible with AMPHP v3 and fibers! 🎉

    As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

  • Released on 2024-03-10 3.0.0 on GitHub

    amphp/mysql 3.0.0

    Stable release compatible with AMPHP v3 and fibers! 🎉

    As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

    • Classes and interfaces now are prefixed with Mysql to avoid collisions with similar names from other libraries.
    • Marked most classes as internal, leaving only interfaces and concrete implementations required to use the API or create a custom connector.
    • MysqlTransaction now extends MysqlLink instead of MysqlExecutor to support nested transactions.
    • MysqlDataType is now an enum of MySQL data type codes and methods to decode data based on type.
    • Result set field data is now available from MysqlResult::getColumnDefinitions() which returns an array of MysqlColumnDefinition objects corresponding to the result set rows.
    • The second param of MysqlStatement::bind() now requires a string. Binding only makes sense with long strings anyway.
    • MysqlConnection is now an interface extending SqlConnection, with SocketMysqlConnection being the implementation.
    • Removed MysqlConnector since the interface was replaced by template types on SqlConnector, i.e. SqlConnector<MysqlConfig, MysqlConnection>
  • Released on 2024-03-10 2.0.0 on GitHub

    amphp/sql 2.0.0

    Stable release compatible with AMPHP v3 and fibers! 🎉

    As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

    • Added template types to interfaces for better type expression on implementations and extensions.
    • All classes now start with Sql as a prefix to avoid name collisions with other libraries.
    • Combined ResultSet and CommandResult into a single interface, SqlResult.
    • SqlTransaction now extends SqlLink instead of SqlExecutor to support nested transactions.
    • Added onCommit() and onRollback() methods to SqlTransaction. These methods attach callbacks after the transaction is either committed or rolled back, respectively.
    • Removed the methods createSavepoint(), rollbackTo(), and releaseSavepont() from SqlTransaction. Use nested transactions through SqlTransaction::beginTransaction() instead.
    • SqlPool now extends SqlConnection instead of SqlLink. SqlPool::extractConnection() returns an instance of SqlConnection instead of SqlLink.
    • Added SqlResult::fetchRow(), which will return a single row (associative array) from the result set on each call until no further rows remain in the result.
    • SqlTransientResource and now extends Amp\Closable.
    • Added SqlTransactionIsolation and an enum-based implementation, SqlTransactionIsolationLevel.
    • Renamed ConnectionConfig to SqlConfig.
    • Renamed FailureException to SqlException.
  • Released on 2024-02-17 2.1.1 on GitHub

    amphp/byte-stream 2.1.1

    What’s Changed

    • Fixed cancellation not being forwarded to split() in splitLines().

    Full Changelog: https://github.com/amphp/byte-stream/compare/v2.1.0…v2.1.1

  • Released on 2024-01-30 1.0.1 on GitHub

    amphp/windows-registry 1.0.1

    What’s Changed

    • Removed nullability from return type of WindowsRegistry::read(), the method throws if the key is not found.

    Full Changelog: https://github.com/amphp/windows-registry/compare/v1.0.0…v1.0.1

  • Released on 2023-12-29 4.0.0 on GitHub

    amphp/websocket-server 4.0.0

    The 4.0.0 release fixes compression support with a couple small compatibility breaks from 3.x.

    Users of 2.x should upgrade directly to 4.0.0.

    Users of 3.x can upgrade directly to 4.0.0 if compression is not being used. If a custom WebsocketAcceptor was created to support compression, this custom implementation may be dropped, instead passing an instance of WebsocketCompressionContextFactory to each Websocket request handler.

    Backward Compatibility Breaks

    • The WebsocketCompressionContextFactory constructor parameter of Rfc6455ClientFactory has been removed and is instead a constructor parameter of the Websocket class.
    • A nullable WebsocketCompressionContext parameter was added to WebsocketClientFactory::createClient().
  • Released on 2023-12-28 2.0.0 on GitHub

    amphp/websocket-client 2.0.0

    Stable release compatible with AMPHP v3 and fibers! 🎉

    As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

    This release is compatible with amphp/http-client@^5 and amphp/websocket@^2. See the release notes of these libraries for further change notes.

    Similar to v1, a Websocket connection is created using Amp\Websocket\Client\connect() or using an instance of WebsocketConnector, calling WebsocketConnector::connect(). The returned WebsocketConnection then is used to send and receive WebSocket messages.

    • Renamed most classes and interfaces to add Websocket as a prefix to avoid name collisions with similarly named classes in other packages which are frequently used together. For example, Connection is now WebsocketConnection.
    • Advanced handshake and connection parameters may be specified using a Rfc6455ConnectionFactory instance provided when constructing a Rfc6455Connector.
    • A global WebsocketConnector instance may be accessed and set via Amp\Websocket\Client\websocketConnector().
  • Released on 2023-11-25 2.0.0 on GitHub

    amphp/parallel-functions 2.0.0

    Stable release compatible with AMPHP v3 and fibers! 🎉

    As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

  • Released on 2023-10-08 2.0.0 on GitHub

    amphp/http-client-cookies 2.0.0

    Stable release compatible with AMPHP v3 and fibers! 🎉

    As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

    • Renamed InMemoryCookieJar to LocalCookieJar
  • Released on 2023-08-25 2.0.0 on GitHub

    amphp/http-server-form-parser 2.0.0

    This release is compatible with amphp/http-server@^3.

    • Renamed BufferingParser and StreamingParser to FormParser and StreamingFormParser, respectively.
    • Removed the parseForm function in favor of the Form::fromRequest() static method.
    • Removed ParsingMiddleware. Use Form::fromRequest() instead.
    • Removed ParseException. Form parsing errors will throw an HttpErrorException from amphp/http-server instead, which do not need to be caught (the server will automatically return an error response).
  • Released on 2023-08-20 3.0.0 on GitHub

    amphp/http-server-session 3.0.0

    This release is compatible with amphp/http-server@^3.

    • Renamed Storage, InMemoryStorage, RedisStorage, DefaultIdGenerator, and Driver to SessionStorage, LocalSessionStorage, RedisSessionStorage, Base64UrlSessionIdGenerator, and SessionFactory, respectively
    • Renamed methods on Session: open() to lock(), save() to commit()
    • Added Session::rollback() to undo local changes and re-read the session data from storage
    • Added SessionTrainer for examining session changes unit testing
  • Released on 2023-08-20 2.0.0 on GitHub

    amphp/http-server-static-content 2.0.0

    This release is compatible with amphp/http-server@^3.

    • DocumentRoot now requires an instance of HttpServer and ErrorHandler to construct
    • Removed DocumentRoot::onStart() and DocumentRoot::onStop(), as it’s now internally registered
    • Removed support for ServerObserver, as it’s been removed from amphp/http-server
    • Added StaticResource to serve a single static file
  • Released on 2023-08-05 2.0.0 on GitHub

    amphp/http-server-router 2.0.0

    This release is compatible with amphp/http-server@^3.

    • A PSR-3 logger is now required in the Router constructor
    • Starting the server with an empty Router is now allowed and only logs a notice instead of throwing an exception
    • Middleware can be added via addMiddleware() instead of stack()
    • Removed support for adding middleware directly via addRoute(), use stackMiddleware() instead if you need this
    • Removed Router::onStart(), as it’s now internally registered
    • Removed support for ServerObserver, as it’s been removed from amphp/http-server
  • Released on 2023-08-05 2.0.0 on GitHub

    amphp/log 2.0.0

    • Increased minimum PHP version to 8.1
    • Make use of fibers with Amp v3 and Revolt
    • Added support for Monolog v3.x

    This release does not contain any changes in comparison to v2.0.0-beta.2.

  • Released on 2022-12-18 3.0.0 on GitHub

    amphp/phpunit-util 3.0.0

    This package has been redesigned for compatibility with AMPHP v3 and fibers. AsyncTestCase serves a similar purpose as before, providing helper methods for unit testing within an async context. Each test case is run within a unique fiber to allow suspending during the test run.

    • AsyncTestCase::setUpAsync() and tearDownAsync() have been removed. Use AsyncTestCase::setUp() and tearDown() instead, as both of these methods are now able to execute async using fibers.
    • AsyncTestCase::createCallback() now returns a Closure. Additionally, an optional parameter for expected arguments upon invocation have been added (uses InvocationMocker::with(...) to set expected arguments).
  • Released on 2021-12-14 1.0.1 on GitHub

    amphp/cluster 1.0.1

    Update to use amphp/file v2.x.

  • Released on 2020-11-18 0.3.2 on GitHub

    amphp/beanstalk 0.3.2

    • Added support for Symfony YAML library v4 and v5. (#34)
  • Released on 2020-03-28 1.0.0 on GitHub

    amphp/serialization 1.0.0

    Initial release.

  • Released on 2019-12-31 1.0.0 on GitHub

    amphp/http-tunnel 1.0.0

    Initial release.

  • Released on 2019-12-21 1.0.0 on GitHub

    amphp/http-client-cache 1.0.0

    Initial release.

  • Released on 2019-11-04 2.1.0 on GitHub

    amphp/react-adapter 2.1.0

    • React\EventLoop\Factory is now automatically replaced with another implementation that throws on each usage to prevent two loops existing concurrently by accident. Set AMP_REACT_ADAPTER_DISABLE_FACTORY_OVERRIDE=1 as environment variable or constant to disable this protection.
  • Released on 2018-03-07 0.1.0 on GitHub

    amphp/react-stream-adapter 0.1.0

    Initial release.