Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pact Php Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Contract Testing Adoption: Enables a shift-left testing strategy by validating API contracts between services early in development, reducing integration failures in CI/CD pipelines.
  • Microservices & API-First Roadmap: Critical for teams adopting microservices, polyglot persistence, or API-first architectures where service boundaries are explicit.
  • Build vs. Buy: Avoids reinventing contract testing wheels; leverages a battle-tested, community-backed solution (Pact’s PHP port) instead of custom scripts or tools like Postman/Newman.
  • Use Cases:
    • Consumer-Driven Contracts: Developers test their service’s interactions with downstream APIs before those APIs are ready.
    • Provider Verification: Ensures provider APIs adhere to consumer expectations without tight coupling.
    • Legacy System Modernization: Safely refactor monoliths by validating new service contracts against existing consumers.
    • Third-Party API Reliance: Mock external APIs (e.g., payment gateways) during local development.

When to Consider This Package

Adopt if:

  • Your stack includes PHP/Laravel and you need contract testing for microservices or APIs.
  • You’re fighting integration failures in CI/CD (e.g., "works on my machine" issues, flaky tests).
  • Teams are developing consumers/providers in parallel and need to decouple their timelines.
  • You prioritize explicit API contracts over implicit documentation (e.g., OpenAPI/Swagger alone).
  • Your org values developer productivity (reduces context-switching to coordinate API changes).

Look elsewhere if:

  • You’re not using PHP/Laravel (consider Pact’s Java/JS/.NET versions).
  • Your APIs are trivially simple (no need for contract validation).
  • You lack test automation maturity (contract testing requires disciplined test practices).
  • You need real-time API mocking (this is for CI/CD, not runtime; pair with tools like WireMock).
  • Your contracts are highly dynamic (e.g., GraphQL schemas with runtime mutations).

How to Pitch It (Stakeholders)

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:

  • Consumers write tests with Pact’s DSL to define expected API interactions (mocked in CI).
  • Providers verify those contracts by replaying interactions against their real API.
  • No more ‘it worked in staging!’—contracts are versioned and enforced. Setup: Add the package, configure a Pact broker (or use local files), and write tests like this:
$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."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui