amphp/mysql
amphp/mysql is an asynchronous MySQL client for PHP built on Amp. It offers non-blocking queries, connection pooling, prepared statements, transactions, and streaming results for high-concurrency, event-driven applications.
Architecture fit: amphp/mysql is an asynchronous MySQL client for the Amp v3 ecosystem (Revolt event loop, fiber-based concurrency), not a Laravel package. It does not integrate with Eloquent, the DB facade, or Laravel's PDO connection resolver, and it cannot serve as a drop-in driver for standard Laravel request lifecycles. Its fit is narrow but real: long-running Amp-based services (async HTTP/WebSocket servers, custom daemons, high-concurrency workers) that need non-blocking MySQL access, or a Laravel application that offloads specific workloads to a dedicated Amp worker process. For a conventional Laravel CRUD app, this package adds architectural surface without benefit.
Integration feasibility: Co-installation with Laravel is straightforward — the package is framework-agnostic and introduces no service providers or config coupling. The cost is operational, not technical: two connection strategies (PDO for the app, Amp for the worker) means two pooling models, two failure-handling paths, and two sets of observability. v3.1.1 is a patch release with no public API changes, so adoption risk from this version specifically is low.
Technical risk: Low for this release. Three signals matter:
chr() deprecation in encodeInt8 removes log noise and future-failure risk on PHP 8.5 upgrades. This is a compatibility fix, not a behavior change.amphp/[email protected] support — dependency-graph unblocking. Risk is transitive: any other Amp package pinned to [email protected] will now conflict, so composer why-not checks are required before bumping.UUID column handling on MariaDB 10.7+, but it is a test addition, not new codec support. It validates existing behavior rather than guaranteeing it across all protocol paths (binary vs. text).Key questions:
amphp/[email protected]?Stack fit: Requires PHP 8.1+ (confirm against the 3.x branch), Amp v3, and Revolt. Sits alongside Laravel 10/11/12 without conflict; does not replace the framework's database layer. Constraint: amphp/[email protected] now permitted, so audit every other Amp dependency for ^3 pins before installing.
Migration path: There is no migration from Eloquent — this is an additive capability. Recommended pattern:
amphp/mysql only inside a purpose-built Amp worker or daemon process.Compatibility: Pin ^3.1.1 to pick up the PHP 8.5 and amphp/[email protected] fixes. Verify MariaDB server version is ≥10.7 if native UUID columns are in scope, and confirm that column type is exercised through the code path your worker actually uses. Run composer update --dry-run in a branch first to surface transitive Amp conflicts.
Sequencing:
amphp/file version across the Amp dependency set.UUID column to validate the newly tested path.Maintenance: Patch-level churn is low, but the Amp ecosystem iterates quickly and major bumps in amp, revolt, or file cascade into this package. Budget for periodic dependency maintenance rather than assuming set-and-forget. The [email protected] compatibility in this release is exactly that kind of unblocking change — expect more of them.
Support: Community-maintained with a small maintainer pool; no commercial backing or LTS commitment. Treat it as a dependency requiring internal ownership — someone on the team must be able to read the source and patch it if upstream stalls. Version pinning plus a vendored-fork contingency is prudent for anything on the critical path.
Scaling: The core value proposition — non-blocking I/O with a built-in connection pool — supports substantially higher per-process concurrency than PDO. The operational trap is pool sizing: an Amp worker can open far more concurrent connections than its synchronous equivalent, so pool limits must be reconciled with MySQL max_connections across all workers and replicas. Under-provisioned pools manifest as queuing latency rather than errors, which is easy to miss without pool-level metrics.
Failure modes:
[email protected] pin elsewhere blocks upgrade and can leave the fleet on a version missing PHP 8.5 fixes.encodeInt8; prior versions will pollute logs and may fail under strict error handlers.Ramp-up: The principal cost is team familiarity with fiber-based async PHP. Debugging differs materially from synchronous Laravel: stack traces cross fiber boundaries, and the mental model for concurrency and cancellation is new. Plan for a spike or paired implementation before committing to production, and document the worker's failure and restart semantics for on-call.
How can I help you explore Laravel packages today?