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.
pact-stub-serviceIf you would like to test with fixtures, you can use the pact-stub-service like this:
$files = [__DIR__ . '/someconsumer-someprovider.json'];
$port = 7201;
$endpoint = 'test';
$config = (new StubServerConfig())
->setFiles($files)
->setPort($port);
$stubServer = new StubServer($config);
$stubServer->start();
$client = new \GuzzleHttp\Client();
$response = $client->get($this->config->getBaseUri() . '/' . $endpoint);
echo $response->getBody(); // output: {"results":[{"name":"Games"}]}
How can I help you explore Laravel packages today?