Repository navigation
Releases: aksoyih/http-mock
Releases · aksoyih/http-mock
Release list
v2.0.0
HTTP Mock v2.0.0
A complete rewrite of aksoyih/http-mock with a modular architecture, flexible request matching, full verification support, and adapters for PSR-18, Guzzle, and Symfony HttpClient.
Breaking Changes
- PHP 8.4+ required (was 8.1+)
MockBuilderreplaced byResponseBuilderwith explicitregister()instead of__destruct()magic- Removed
withDelay()/withGlobalError()— v2 focuses on response mocking and verification
New Features
- Static facade API —
HttpMock::when(),HttpMock::fake(),HttpMock::verify() - Flexible request matching — exact, wildcard (
*,**), regex (#pattern#), and callable matchers viaHttpMock::whenMatching() - Request verification —
assertCalled(),assertCalledTimes(),assertNotCalled(), andexpect()constraints (times,atLeast,atMost) - PSR-18 adapter —
HttpMock::createClient()returns aPsr\Http\Client\ClientInterface - Guzzle adapter —
HttpMock::createGuzzleHandler()for Guzzle'sHandlerStack - Symfony adapter —
HttpMock::createSymfonyClient()returns aSymfony\Contracts\HttpClient\HttpClientInterface - Unmatched request handling — strict mode (default), 404 fallback, or custom callable
MocksHttpPHPUnit trait — automaticreset()after each testHttpMock::scoped()— auto-reset via try/finallyHttpMock::fake()— shorthand for defining multiple mocks at once
Quality
- PHPStan level 9 — zero errors
- Laravel Pint (PSR-12) code style
- 84 tests, 136 assertions (unit + integration + feature)
- GitHub Actions CI pipeline
Dependencies
psr/http-client^1.0psr/http-factory^1.0nyholm/psr7^1.0- Optional:
guzzlehttp/guzzle^7.0,symfony/http-client^7.0