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

Http Laravel Package

phrity/http

Phrity Http provides small PSR-friendly utilities for HTTP in PHP. Includes an HttpFactory wrapper that combines PSR-17 factories (or auto-configures from a single implementation) and a Serializer that converts PSR-7 requests/responses/messages to raw HTTP strings.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Unified HTTP Abstraction Layer: Standardize PSR-17 implementations (e.g., Nyholm, Guzzle) across Laravel microservices to eliminate vendor lock-in and simplify dependency management. The HttpFactory enables seamless switching between implementations without refactoring business logic.
  • Enhanced Debugging & Observability: The Serializer provides raw HTTP message dumps (requests/responses) for logging, monitoring, and troubleshooting in distributed systems. Critical for API gateways, service meshes, or Laravel applications with complex HTTP integrations.
  • Test Automation & Mocking: Generate synthetic HTTP messages via HttpFactory to replace external API dependencies in unit/integration tests, reducing flakiness and improving CI/CD reliability. Complements Laravel’s Http::fake() but offers PSR-7 flexibility.
  • Roadmap for HTTP Tooling: Lay the foundation for future features like:
    • Request/Response Validation: Integrate with Laravel’s validation pipeline or custom middleware.
    • Transformation Pipelines: Chain serializers/deserializers for API normalization (e.g., GraphQL ↔ REST).
    • Middleware Composition: Extend HttpFactory to include PSR-15 middleware support.
  • Build vs. Buy Decision: Avoid reinventing PSR-17 wrappers or serialization logic. This package accelerates development while maintaining compatibility with Laravel’s ecosystem (e.g., Symfony’s HttpClient, Guzzle, or Nyholm PSR-7).

When to Consider This Package

  • Adopt if:
    • Your Laravel/PHP stack relies on PSR-7/PSR-17 (e.g., for HTTP clients, middleware, or frameworks like Lumen/Slim).
    • You need interchangeable HTTP factories (e.g., switching between Guzzle/Nyholm implementations without code changes).
    • Debugging requires human-readable HTTP message serialization (e.g., logging raw requests/responses for observability).
    • You’re building test doubles for HTTP components (e.g., mocking requests/responses in Laravel tests).
    • Your team prioritizes reducing technical debt in HTTP-related codebases.
  • Look elsewhere if:
    • Your project doesn’t use PSR-7/PSR-17 (e.g., legacy Symfony HTTP components or raw cURL).
    • You need advanced HTTP features (e.g., retries, OAuth signing, or gRPC support) beyond PSR-17.
    • The package’s maturity (0 stars, recent releases) is a concern for production-critical systems. Mitigate with CI/CD validation and fallback strategies.
    • You require Laravel-specific integrations (e.g., Illuminate HTTP clients, middleware, or Blade templating). This package is framework-agnostic.
    • Your team lacks bandwidth to contribute to or monitor an external package with minimal adoption.

How to Pitch It (Stakeholders)

For Executives: "This package standardizes how our PHP services handle HTTP traffic, reducing complexity and costs. By consolidating PSR-17 implementations (e.g., Guzzle vs. Nyholm), we eliminate vendor lock-in and simplify maintenance. The built-in serializer also gives us superior debugging—we can log raw HTTP messages to quickly diagnose API issues, which is critical for our [e.g., payment processing, third-party integrations]. It’s a low-risk investment (MIT license, PSR-compliant) with high rewards for scalability and observability."

For Engineering: *"The HttpFactory lets us compose PSR-17 factories dynamically, while the Serializer gives us a clean way to log/inspect HTTP messages. Here’s how it helps:

  • Unify HTTP clients across microservices (e.g., switch between Guzzle/Nyholm without code changes).
  • Testing: Generate synthetic requests/responses to mock APIs in unit tests—no more flaky CI pipelines.
  • Debugging: Log raw HTTP traffic for troubleshooting (e.g., Log::info($serializer->request($request))). Works with Laravel via PSR-17 adapters (e.g., nyholm/psr7). Just composer require phrity/http—minimal setup, maximum flexibility.*

For Developers: *"This package solves two key pain points:

  1. PSR-7 Factory Spaghetti: No more writing custom wrappers for Guzzle/Nyholm. The HttpFactory handles it.
  2. Debugging Hell: The Serializer turns opaque HTTP messages into readable strings—perfect for logging or debug bars. Example use case: Replace this:
$request = new \Nyholm\Psr7\Request('GET', '/');

With this:

$factory = HttpFactory::create(new \Nyholm\Psr7\HttpFactory());
$request = $factory->createRequest('GET', '/');

Bonus: Use the serializer to log requests like Log::debug($serializer->request($request))."*

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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor