mcustiel/phiremock-codeception-extension
A Codeception extension that starts a Phiremock Server before a test suite and stops it afterward. Configure listen address, binary path, logs, debug, readiness waits, and expectations for easier HTTP mocking.
Http::fake()), rather than discovered later as migration friction.Http::fake() / Http::preventStrayRequests() get the same isolation in-process with no extra server, no extra port, no extra process supervision. That is the honest baseline this package must beat.Adopt when several of these are true:
codeception.yml / suite YAML. The extension is configured entirely through the extensions: block — no bootstrap PHP, no CI shell scripts. If you are not on Codeception, this package has no surface area for you.Http::fake() intercepts the client before the transport layer, which means it will not exercise Guzzle handler stacks, retry/backoff middleware, connection-refused and timeout paths, DNS failures, TLS behavior, or any outbound call made from a separate process (queue worker, scheduler, Octane worker, a Node/Cypress end-to-end run, a Python data job). A listening mock server on 127.0.0.1:18080 covers all of those; a fake does not.certificate / certificate_key / cert_passphrase options let you test HTTPS-only code paths (strict certificate verification, SNI, misconfigured-CA error handling) that are genuinely painful to simulate in-process. Few fakes can do this at all.extra_instances with per-instance listen, expectations_path, and suites lets one config stand up, say, an HTTP instance for api and an HTTPS instance for acceptance, sharing one YAML file. That is a real ergonomic win over hand-rolled process management.wait_until_ready with wait_until_ready_timeout/interval health-gates the suite instead of a start_delay sleep. For flaky CI this is the single most valuable option in the package; if you adopt it, turn this on.require-dev only and never ships to production, so most legal reviews clear it, but get that in writing before adoption rather than after.Look elsewhere when:
Http::fake() + Http::preventStrayRequests() inside a Pest/PHPUnit test gives you isolation with zero new processes, zero ports, zero cleanup, and no dependency. Reach for a live mock server only if you can articulate a specific gap (process boundary, TLS, cross-language consumer) that fakes cannot close.docker-compose service or Testcontainers gives you the same endpoint with better portability, no PHP-specific glue, and no single-maintainer risk.To executives — one paragraph: This is a small, free, open-source test-infrastructure helper. It automatically stands up a simulated third-party API before our automated test suite runs and tears it down after. Practically, it lets us test payment, identity, shipping, and other vendor integrations without calling the vendor — no sandbox credentials, no rate limits, no waiting on their outages. The upside is faster, more reliable releases and fewer "the vendor was down so we skipped QA" incidents. The cost is near zero in licensing and engineering time, but it carries single-maintainer risk and a GPL-3.0 license that legal should clear as a development-only dependency. Recommendation: a time-boxed spike (1–2 sprints of one engineer at part-time capacity), gated on a clear before/after on build flake rate — not a wholesale adoption.
To engineering leadership — the honest framing:
phiremock-server on suite begin, health-checks it, and kills it on suite end. All the actual stubbing intelligence lives in Phiremock Server, which is a separate dependency you may or may not add.Http::fake(), Mockery, Guzzle mock handlers) cover our cases, this package is redundant and we should say no quickly. It earns its place only where the transport layer itself is under test — retries, timeouts, TLS, or calls originating outside the PHP request lifecycle.extra_instances if you want HTTP and HTTPS), a supervised child process, and log files under the tests output dir. Small, but real — it is one more thing that can fail on a CI box with constrained ports or zombie process reaping. The wait_until_ready health gate is what keeps that from becoming flake; default it to true in our config rather than accepting the package's false.docker-compose service is a half-day job.How can I help you explore Laravel packages today?