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 Factory Guzzle Laravel Package

http-interop/http-factory-guzzle

View on GitHub
Deep Wiki
Context7

Getting Started

This package provides a PSR-17 HTTP factory implementation using guzzlehttp/psr7. It’s meant as a compatibility bridge for projects still on Guzzle 1.x (which lacks a built-in factory), but note: since guzzlehttp/psr7 v2.0+ includes a built-in factory (GuzzleHttp\Psr7\HttpFactory), this package is now largely deprecated. First check whether your project already depends on guzzlehttp/psr7:^2.0; if so, use the official factory instead. If stuck on ^1.x, install this package:

composer require http-interop/http-factory-guzzle

Then use it to create PSR-7/17 objects:

use Http\Factory\Guzzle\Factory;

$factory = new Factory();
$request = $factory->createRequest('GET', 'https://example.com');
$response = $factory->createResponse(200);

Implementation Patterns

  • DI container integration: Register Http\Factory\Guzzle\Factory as a shared service for PSR-17 interfaces (Psr\Http\Message\RequestFactoryInterface, etc.). Laravel developers can bind it in a service provider:
    $this->app->singleton(RequestFactoryInterface::class, Factory::class);
    
  • Adapter layer: Use when integrating older Guzzle-based HTTP clients (e.g., legacy Guzzle 6 wrappers) into modern PSR-17-compliant code. For example, construct requests before passing them to a PSR-18 client.
  • Fallback fallback: Only use this package if you cannot upgrade to guzzlehttp/psr7:^2.0 and still need factory methods for PSR-7/17 objects.

Gotchas and Tips

  • ⚠️ Deprecated / discouraged: Since 2021, guzzlehttp/psr7 v2+ provides a better-supported official factory. Prefer that—this package is effectively unmaintained (last release: July 2021) and adds little value now.
  • Version compatibility: v1.x requires guzzlehttp/psr7:^1.7 or ^2.0, but for Guzzle 2.x (which is extremely rare today), you’ll need legacy branches—avoid if possible.
  • Debug tip: If you see “Call to undefined function Http\Factory\Guzzle…”, ensure guzzlehttp/psr7 is installed and the correct version (>=1.7) is loaded.
  • Extension point: While not extensible itself, it’s compatible with PSR-17’s interfaces—wrap it in your own factory for logging or modification if absolutely necessary (but again, prefer the official one).
  • Future-proofing: Audit dependencies for guzzlehttp/psr7 usage. If indirect dependency pins old versions, update or use composer require guzzlehttp/psr7:^2.0 --with-all-dependencies carefully.
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