amphp/postgres
Asynchronous, non-blocking PostgreSQL client for PHP built on Amp. Supports connection pooling, prepared statements, transactions, and concurrent queries, making it ideal for high-performance event-driven applications.
Architecture fit — poor-to-moderate as a "Laravel package," good as an isolated async data path.
amphp/postgres is not a Laravel package. It is a low-level, non-blocking PostgreSQL wire-protocol client for the Amp v3 ecosystem (Fibers + revolt/event-loop). It ships no service provider, no facade, no Eloquent driver, no query builder, no migration integration, and no DB::listen hooks. Laravel's persistence layer is PDO-based and synchronous by design. There is no supported path to "swap the driver" — integration means running a parallel data access path in a process whose control flow is owned by the Revolt loop.
The honest architectural read: this is viable only where you can carve out a bounded async context — a long-running daemon, a fan-out aggregator, a LISTEN/NOTIFY consumer, a websocket/SSE service — that does not need Eloquent, transactions spanning the sync/async boundary, or Laravel's query observability. Inside a normal FPM request or a standard Octane worker, dropping Amp in inverts the execution model and buys nothing.
Integration feasibility — technically straightforward, organizationally expensive.
composer require amphp/postgres pulls Amp v3 + Revolt; PHP 8.1+ is satisfied by current Laravel.sleep(), or filesystem read inside the loop stalls all concurrent Postgres work in that process. Mixed sync/async code in one process is the primary footgun.BEGIN/COMMIT/ROLLBACK and release is your responsibility across fiber suspensions. Laravel gives you none of this for free.Technical risk — concentrated in duplication and semantics, not in the library itself.
DB::transaction retry-on-deadlock, no model events, no factories, no Telescope visibility.Key questions before approval
pgbouncer + tuned PDO pools? Any of these may deliver the same throughput with zero new architecture.Stack fit. Suitable as a sidecar data path, not as a Laravel DB driver. Keep Laravel/PHP-FPM or Octane-Swoole for the request/response surface and Eloquent; confine amphp/postgres to processes where the Revolt loop is the top-level owner and no PDO handle is ever opened.
Migration path. Do not migrate. Add. A credible first increment:
revolt/event-loop that opens a pool, runs a representative fan-out query set (e.g., 200 concurrent small queries), and is benchmarked against the same workload on PDO + pgbouncer.AsyncReportRepository) with a PDO implementation as the fallback, so the rest of the app is unaware of which is in use.Compatibility. PHP 8.1+ and current Laravel versions are fine at the language level. Real incompatibilities are runtime: Revolt vs. Swoole in the same process, PDO/blocking calls inside fibers, and any package that assumes DB:: is the only way to reach Postgres. Audit middleware and service providers that touch the DB before running them in an async process.
Sequencing.
LISTEN/NOTIFY if that is the actual driver.Maintenance. The library itself is small, MIT, single-purpose, and actively released (latest 2026-02-25), so per-version maintenance is low. The maintenance cost is the integration: pool configuration, transaction discipline, and keeping the Amp/Revolt versions aligned with the rest of the dependency graph. Budget a recurring, non-trivial line item rather than a one-off.
Support. Community-only, small maintainer pool, low star count. No commercial backing. Internal ownership must be explicit — a named engineer, not "the platform team." Assume Stack Overflow will not answer your pool-exhaustion question.
Scaling. Genuinely strong where it applies: one process can service many concurrent queries without a thread or process per connection, which meaningfully reduces pressure on Postgres max_connections and enables high-fan-out aggregation and pub/sub workloads that are awkward on PDO. Scaling caveats are on you: pool size must be tuned against Postgres connection limits across all consumers, and throughput is capped by the single-threaded event loop — CPU-bound work on the async path is a regression, not a win.
Failure modes to instrument for.
finally-based release.idle in transaction, blocking vacuum.Ramp-up. Moderate-to-high. Developers fluent in Eloquent and PDO must learn cooperative concurrency, fiber suspension points, structured concurrency, and manual pool/transaction lifecycle. The failure modes are non-obvious and intermittent, which is the worst combination for on-call. Plan for a written internal pattern doc and paired review on the first service.
Recommendation posture. The score (9.28) reflects a well-built library; the opportunity score (2.41) reflects a narrow one. Approve behind a spike with a hard gate: measurable p95 or connection-count improvement over Octane-Swoole and pgbouncer baselines, plus a bounded async context with no Eloquent dependency. Reject if the motivation is general modernization rather than a specific, measured I/O-concurrency bottleneck.
How can I help you explore Laravel packages today?