Product Decisions This Supports
- Unified HTTP Client Abstraction: Enables a standardized interface for HTTP requests across Laravel/PHP applications, reducing vendor lock-in (e.g., switching between Guzzle, cURL, or ReactPHP without refactoring).
- PSR-7 Compliance: Aligns with modern PHP standards, easing integration with other PSR-compliant libraries (e.g., middleware, message buses).
- Event-Driven Extensibility: Supports middleware-like behavior (logging, retries, caching) via Symfony’s EventDispatcher, enabling modular feature development (e.g., analytics, rate limiting).
- Deprecation Migration Path: Provides a bridge to adopt php-http/httplug (the successor), reducing technical debt during transitions.
- Performance Optimization: Adapter-specific optimizations (e.g., async ReactPHP for concurrent requests) without sacrificing consistency.
- Testing & Debugging: Built-in event subscribers for request/response journaling, error handling, and status code validation, improving observability.
When to Consider This Package
- Avoid if: Your project already uses php-http/httplug (the modern standard) or requires active feature development (this package is deprecated).
- Consider if:
- You need multi-adapter support (e.g., fallback from Guzzle to cURL) in a legacy Laravel app.
- Your team lacks time to migrate to httplug but needs PSR-7 compliance.
- You require event-driven HTTP middleware (e.g., caching, retries) without reinventing the wheel.
- Your use case involves parallel requests (e.g., batch processing) with built-in error handling.
- Look elsewhere if:
- You’re starting a new project (use httplug or Guzzle HTTP Client directly).
- You need active maintenance (this package is deprecated; open issues may go unaddressed).
- Your stack is non-PHP (e.g., Node.js, Python).
How to Pitch It (Stakeholders)
For Executives:
"This package lets us standardize HTTP calls across our Laravel services using a single, PSR-7-compliant interface—reducing complexity and maintenance costs. It supports 15+ HTTP clients (Guzzle, cURL, ReactPHP) and includes built-in tools for logging, caching, and retries, which could cut debugging time by 30%. While deprecated, it’s a stable bridge to modern standards like php-http/httplug, ensuring we don’t disrupt existing integrations during migration."
For Engineers:
*"Ivory HTTP Adapter gives us:
- Adapter Agnosticism: Switch between Guzzle, cURL, or async ReactPHP without changing business logic.
- Event-Driven Extensions: Add middleware-like behavior (e.g., request logging, rate limiting) via Symfony events—no custom code needed.
- PSR-7 Compliance: Future-proofs our HTTP layer for integration with other PSR-compliant tools.
- Deprecation Safety: Since it’s a drop-in for httplug, we can migrate incrementally.
Tradeoff: It’s deprecated, but the core functionality is stable. If we need new features, we’ll migrate to httplug—this buys us time to refactor safely."*
For Developers:
*"Use this to:
- Unify HTTP clients in your Laravel app (e.g.,
HttpAdapterFactory::create('guzzle')).
- Leverage events for cross-cutting concerns (e.g., cache responses with
CacheSubscriber).
- Debug easily with built-in logging or request journaling.
- Test parallel requests (e.g.,
adapter->sendMulti($requests)).
Example:
$adapter = new Ivory\HttpAdapter\EventDispatcherHttpAdapter(
new Ivory\HttpAdapter\Adapter\GuzzleAdapter(),
new Symfony\Component\EventDispatcher\EventDispatcher()
);
$adapter->getEventDispatcher()->addSubscriber(new Ivory\HttpAdapter\Event\Subscriber\LoggerSubscriber());
$response = $adapter->sendRequest(new Psr\Http\Message\Request('GET', 'https://api.example.com'));
Migration Path: Replace with php-http/httplug later by swapping the adapter factory."*