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

Mock Client Laravel Package

php-http/mock-client

Mock HTTP client for HTTPlug/PHP-HTTP. Stores outgoing requests and returns queued responses or throws exceptions instead of making real network calls—ideal for unit tests of HTTP-dependent code. Install via Composer as a dev dependency.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit is strong due to Laravel's native PSR-18 compliance via Guzzle, making this mock client a natural fit for HTTP-related tests. Integration feasibility is high—Laravel's service container allows seamless replacement of the HTTP client with the mock during testing via simple binding. Technical risk is low as it's purely a test utility with no production surface area, though minor risks exist around edge cases in middleware handling or async request simulations if Laravel's HTTP client usage deviates from standard PSR-18 behavior. Key questions include: How does it interact with Laravel's built-in HTTP client middleware? Does it support Laravel-specific test contexts (e.g., database transactions)? What version compatibility exists with Laravel's HTTP client implementation?

Integration Approach

Stack fit is excellent—Laravel's default HTTP client (Guzzle) is PSR-18-compliant, and the mock client works directly with PHPUnit/Pest test suites without additional tooling. Migration path requires minimal effort: bind the MockClient to the Http\Client interface in test environment service providers, then queue responses/exceptions in test setup blocks. Compatibility is near-perfect for standard Laravel HTTP usage, though custom Guzzle client configurations (e.g., non-standard handlers) may require validation. Sequencing involves: (1) configuring mock responses in test setup, (2) injecting the mock into the container, (3) executing tests where HTTP calls are intercepted, and (4) asserting request patterns via the mock's inspection methods.

Operational Impact

Maintenance is negligible—minimal code footprint and MIT licensing eliminate ongoing overhead, though low community adoption (71 stars) may slow issue resolution for niche scenarios. Support relies primarily on documentation since community channels are limited,

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport