pact-foundation/pact-php
PHP implementation of the Pact consumer-driven contract testing framework. Define contracts between services, run provider verification, and integrate with PHPUnit/CI to prevent breaking API changes. Supports HTTP interactions, mock servers, and Pact Broker workflows.
Adopt if:
Look elsewhere if:
For Executives: "This package lets us eliminate API integration surprises in production by enforcing contracts between services before they’re deployed. Think of it like a ‘pre-flight check’ for APIs—catching mismatches early when they’re cheap to fix. For example, if Team A changes a payment API endpoint, Team B’s consumer tests will fail immediately in CI, not after launch. This reduces fire drills, speeds up releases, and aligns with our microservices roadmap. It’s a low-risk investment with high upside for stability and velocity."
For Engineering: *"Pact-PHP gives us consumer-driven contract testing natively in Laravel. Here’s how it works:
$pact = new Consumer('my-service', new Provider('payment-api'));
$pact->given('a user exists')
->uponReceiving('a payment request')
->withRequest('POST', '/pay', ['amount' => 100])
->willRespondWith(200, ['status' => 'paid']);
Why now? Because our API surface is growing, and we’re seeing more integration debt. This is the missing piece to make microservices actually independent."*
How can I help you explore Laravel packages today?