amphp/sql-common
Shared interfaces and abstractions for asynchronous SQL database clients in Amp, including connection pools, query result interfaces, and common SQL exceptions. It forms the foundation for amphp/mysql and amphp/postgres.
amphp/sql-common is the shared implementation layer beneath amphp/mysql and amphp/postgres (connection pooling, connection/config abstractions, query results, transactions). Product teams don't adopt it; they adopt one of the parent drivers, and this arrives transitively. Treat any evaluation as a proxy for "how healthy is the async SQL stack we're standardizing on?"PDO/Laravel DB facade model in the same process. That has downstream consequences for hiring, on-call runbooks, observability tooling, and how much of the existing Eloquent-based codebase is reusable.Consider the parent drivers (and therefore this package) when:
Look elsewhere when:
PDO/the DB facade, Eloquent, and the existing queue workers already meet the need; adding an async driver adds a second data-access paradigm for no user-facing gain.Practical guidance: never add amphp/sql-common as a direct dependency. Depend on amphp/mysql or amphp/postgres, pin versions, and assume the shared internals may change between minor releases. Evaluate ecosystem health at the driver level, not here.
To executives: This is a free (MIT), low-level component that sits underneath two open-source database drivers. It is not a product we buy or a service we run — it's a transitive dependency that only becomes relevant if we commit to a particular performance architecture (long-running PHP services handling many concurrent database calls). There is no license cost and no direct commercial exposure. The real decision on the table is whether that architecture is worth the investment; this package is a consequence of that decision, not a reason for it. The risk to flag is concentration: a very small maintainer community means we would be a disproportionately large consumer, so any commitment should come with our own integration test coverage and a fallback plan.
To engineering: Don't take a direct dependency — pull it in via amphp/mysql or amphp/postgres and let Composer resolve it. Pin versions and treat the internal API as unstable across minor releases. What you get is a consistent pooling, connection, transaction, and query-result model shared across both engines, which reduces the cost of supporting MySQL and PostgreSQL side by side. What you take on is event-loop-native data access: pool sizing, backpressure, cancellation semantics, and graceful shutdown all become our responsibility, and none of it composes with Eloquent or the framework's database layer. If we go this route, we should budget for an internal abstraction boundary around the driver so we can swap it out without rewriting product code, plus load tests that exercise pool exhaustion and query timeout paths before we put customer traffic behind it.
Recommendation: Do not treat amphp/sql-common as a decision item. Decide on the async runtime and the parent driver on their merits; adopt this implicitly, wrap it, and re-evaluate if the maintainer base or release cadence deteriorates.
How can I help you explore Laravel packages today?