codeception/module-amqp
Codeception module for testing AMQP messaging, usually RabbitMQ, in PHP. Adds helpers to declare queues and exchanges, publish messages, and grab or consume them in tests so you can verify message flows alongside your application code.
What it is. codeception/module-amqp is the official Codeception helper module that exposes AMQP broker state to Codeception test suites. It wraps php-amqplib and surfaces assertions such as seeQueueIsEmpty, seeMessageInQueue, seeMessageInQueueCount, purgeQueue, scheduleMessage, and grabMessageFromQueue directly inside Cept/Cest test classes. It is a test-harness dependency: it never ships to production and carries no runtime surface in the application.
Architecture fit. Fit is binary and decided entirely by one question — is our test suite Codeception-based? If yes, this module is the canonical, idiomatic way to assert on RabbitMQ state and slots cleanly into the .suite.yml config model. If the estate is PHPUnit/Pest-first, the module is not usable at all; teams would instead pull php-amqplib in as a dev dependency and write a trait or custom assertion helper, which is roughly 100–200 lines of work.
Signal interpretation. The alarming-looking metrics (4 stars, 0 dependents) are misleading and should be read carefully. Codeception's helper modules were split out of the codeception/codeception monorepo around 2020, so they live in the org namespace as thin satellite packages rather than as standalone OSS projects. Stars and dependents are low because nobody adds a test helper as a transitive dependency and nobody stars infrastructure. The 2025-07-25 release date is the real health indicator and it is positive — the package is receiving maintenance releases, including PHP 8.x and Codeception 5 alignment.
Technical risk (ranked).
purgeQueue but does not enforce cleanup; the CI scaffold must.php-amqplib, so a hard fork is cheap (MIT license permits it).php-amqplib major versions and Codeception majors; a Codeception 5→6 bump could lag.Key questions for the team.
php-amqplib major are we on?Stack fit. Required: PHP 8.x, Codeception 5.x, php-amqplib 3.x, and a broker reachable from the test runner. Install is composer require --dev codeception/module-amqp. It is strictly a require-dev entry — verify it does not leak into the production lockfile's autoload path.
Sequencing. Integration is a one-sprint task, best run as a narrow pilot rather than a suite-wide mandate:
acceptance.suite.yml with connection parameters sourced from environment variables, and prove one end-to-end assertion — publish via the application code path, assert seeMessageInQueue, purge, assert seeQueueIsEmpty._before/_after hook that purges the queues under test. Bake this in before widening adoption — retrofitting cleanup across an existing suite is where pilot projects die.Migration path. Greenfield — this is additive. There is no migration from an existing tool; the closest comparison is hand-rolled php-amqplib assertions, and replacing those with module methods removes boilerplate rather than adding a dependency burden. If the organisation later moves to Pest/PHPUnit, the exit cost is low: the module's value is concentrated in a handful of assertion helpers that are straightforward to reimplement.
Compatibility. Confirm the module's composer.json constraints against the pinned Codeception and php-amqplib versions before committing; the package's release cadence means constraints are usually current, but a stale pin in our own lockfile is the likelier failure. Docker/Testcontainers-based brokers are the recommended target — do not point CI at a shared staging broker, as test purges would corrupt shared state.
Maintenance. Near-zero. It is a dev dependency with no deployed footprint, no runtime attack surface, no data handling, and no licensing exposure (MIT). The real maintenance cost is not the package — it is the broker container and the test-suite hygiene it demands.
Support. Upstream is the Codeception organisation with a recent release, so support is adequate for a package of this size. Because the dependency graph is shallow, we retain the ultimate fallback: fork, vendor, or reimplement. Treat "vendor a copy if upstream stalls" as a pre-approved contingency rather than an escalation.
Scaling. Scales linearly with test volume, which is the constraint. Each AMQP assertion is a network round-trip to a broker. At hundreds of message-queue tests, suite wall-clock time becomes the limiting factor and CI cost rises in step. Mitigations: keep AMQP assertions in a dedicated suite that runs on PR-merge rather than every commit, use a small number of long-lived connections, and avoid per-test broker restarts.
Failure modes and tripwires.
Ramp-up. Low. Engineers familiar with Codeception write these assertions on day one; the module's API is self-describing. The learning is not the package but message-queue testing discipline — asynchrony, eventual consistency, and teardown. Budget a short internal write-up on the teardown convention and the pitfalls of asserting on a broker before the consumer has drained it.
Verdict. Adopt if — and only if — Codeception is the incumbent test framework. The package is the right, low-risk, correctly-maintained choice for that narrow case, and the cost is bounded and reversible. Do not adopt as a reason to introduce Codeception, and do not let the 4-star / 0-dependent surface signal drive the decision; those numbers reflect the package category, not its quality. The genuine risk sits entirely in broker lifecycle management and test hygiene, which are ours to own, not the package's to solve.
How can I help you explore Laravel packages today?