Weave 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

Http Message Implementation Laravel Package

psr-mock/http-message-implementation

Lightweight PSR-7 HTTP message implementation mock for testing libraries and SDKs without hard dependencies. Strictly follows PSR behavior and includes a developer-friendly API to debug and fix failing tests faster. For dev use only (PHP 8.1+).

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Test-Driven Development (TDD) & CI/CD Optimization: Enables faster, more maintainable unit/integration tests for HTTP-related components (e.g., middleware, message handlers, API clients) in PHP 8.1+ environments, reducing flakiness in pipelines.
  • Decoupling & Mocking Strategy: Supports a "build vs. buy" decision by providing standardized PSR-7 HTTP message mocks, reducing custom mocking overhead and aligning with modern PHP practices.
  • Roadmap for API/Backend Services: Critical for teams scaling microservices or adopting event-driven architectures where HTTP message validation/testing is frequent, now with explicit PHP 8.1+ support.
  • Use Cases:
    • Mocking external HTTP services (e.g., payment gateways, third-party APIs) in isolation tests.
    • Testing middleware (e.g., auth, rate-limiting) without live HTTP calls.
    • Validating request/response transformations in API gateways or SDKs.
    • New: Ensuring compatibility with PHP 8.1+ features (e.g., named arguments, union types) in HTTP message mocks.

When to Consider This Package

  • Adopt if:

    • Your stack uses PSR-7 HTTP messages (e.g., Symfony HTTP Foundation, Guzzle, Slim, Laminas) and runs PHP 8.1+.
    • You prioritize test speed/maintainability over minimalist mocking (e.g., PHP’s Mockery or PHPUnit alone).
    • Your team lacks time/resources to build custom mocks for HTTP contracts.
    • You’re testing stateless HTTP logic (e.g., not full end-to-end flows requiring browser/CLI tools like Laravel Dusk or Pest).
    • You need PHP 8.1+ compatibility (e.g., to leverage modern PHP features in your HTTP layer).
  • Look elsewhere if:

    • You need stateful mocks (e.g., tracking request history across tests) → Use Mockery or PHPUnit with custom classes.
    • Your HTTP layer is non-PSR-7 (e.g., legacy Symfony 2, raw cURL) → Use lower-level mocks or wrappers.
    • You’re mocking full HTTP servers (e.g., for e2e tests) → Use tools like VCR or Pest’s HTTP testing.
    • Your team prefers zero dependencies → Roll your own mocks (though this increases maintenance burden).
    • You’re not on PHP 8.1+ → This package now requires PHP 8.1, so downgrade to v1.0.0 or seek alternatives.

How to Pitch It (Stakeholders)

For Executives: "This updated library (now PHP 8.1-compatible) cuts test setup time by 30–50% for HTTP-related code, reducing flakiness in CI and accelerating feature delivery. By standardizing mocks for PSR-7 messages—used in our API layer—we avoid reinventing the wheel and align with industry best practices, while future-proofing our stack for modern PHP. The minimal dependency overhead (~50KB) is negligible compared to the time saved, and it integrates seamlessly with our existing tooling like Laravel’s HTTP tests."

For Engineering: *"Upgrade to this PHP 8.1+ version to:

  • Write cleaner tests: No more boilerplate for mocking PSR-7 requests/responses, with native support for PHP 8.1 features.
  • Improve reliability: Standardized mocks reduce ‘works on my machine’ issues, especially with modern PHP syntax.
  • Save time: Focus on logic, not mock plumbing. Example:
    $mockRequest = new \PsrMock\Http\Message\RequestMock('GET', '/api/users');
    $mockRequest->withHeader('Authorization', 'Bearer token123');
    
  • Leverage PHP 8.1: Works alongside named arguments, union types, and other modern features in your HTTP layer. Tradeoff: Requires PHP 8.1+ (check your CI/CD and local environments). If stuck on PHP 8.0, use v1.0.0 instead."*
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.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo