buero/pact-bundle package is a Pact contract testing bundle for Laravel, designed to enforce consumer-provider contracts in a microservices or polyrepo architecture. It aligns well with:
Illuminate\Http) and can mock external services.symfony/flex or manual bootstrapping.pact-foundation/pact-php), which must be configured separately.pact-broker interactions).| Risk Area | Description | Mitigation Strategy |
|---|---|---|
| Contract Versioning | Misaligned Pact versions between consumer/provider can break tests. | Enforce semantic versioning in CI and document versioning policies. |
| State Management | Testing stateful APIs requires mocking DB/queues, adding complexity. | Use Laravel’s testing helpers (e.g., RefreshDatabase) or Pact’s state providers. |
| Performance Overhead | Pact verification can slow down CI pipelines if not optimized. | Run provider tests in parallel; cache contract artifacts. |
| Laravel-Specific Gaps | Bundle may not account for Laravel’s unique features (e.g., Eloquent). | Extend the bundle or wrap Pact calls in Laravel services. |
| Broker Dependency | Requires a Pact Broker (e.g., self-hosted or cloud) for contract storage. | Start with local broker (Docker) for dev; migrate to cloud in production. |
| Component | Required Version | Notes |
|---|---|---|
| PHP | 8.0+ | Pact PHP library may have lower bounds; test with your PHP version. |
| Guzzle | 6.5+ | For HTTP interactions in provider tests. |
| Pact Broker | 2.0+ | Self-hosted (Docker) or cloud (e.g., Pactflow). |
composer require buero/pact-bundle
config/pact.php (merge with Laravel’s config).# docker-compose.yml
pact_broker:
image: pactfoundation/pact-broker
ports:
- "80:80"
Pact\Consumer).Pact\Provider)../vendor/bin/pact-publish --consumer my-consumer --provider my-provider
- name: Pact Consumer Tests
run: ./vendor/bin/pact-test
- name: Pact Provider Verification
run: ./vendor/bin/pact-verify
{id}).actingAs() or custom interceptors.fake() or Pact’s state management.buero/pact-bundle for updates (low activity; may require forks for critical fixes).config/pact.php) to avoid per-project differences.pact-broker logs and Pact’s CLI tools (pact-inspect).dd() or Xdebug for provider test failures.How can I help you explore Laravel packages today?