guzzle/common
guzzle/common provides the shared utility layer used by Guzzle: collections, event dispatching, caching helpers, and other common abstractions that power Guzzle HTTP clients and related packages. Useful when maintaining legacy Guzzle 3-based code.
guzzle/common package (Guzzle 3’s legacy Common component) provides foundational utility classes (e.g., Guzzle\Common\Collection, Guzzle\Common\ToStringInterface) that could enhance modularity in a Laravel/PHP application. However, Guzzle 3 is obsolete (released in 2013), and its design patterns (e.g., PSR-0, pre-PSR-4) may not align with modern Laravel (PSR-4, dependency injection, service containers).Illuminate\Support\Collection, Illuminate\Support\Str) or PSR-compliant alternatives (e.g., psr/log). This package risks redundancy unless addressing niche use cases (e.g., legacy Guzzle 3 integrations or custom serialization).autoload overrides or a custom psr-4 alias, complicating CI/CD and IDE tooling.ReflectionClass usage, stream handling).Guzzle\Common\EventManager) are less optimized than modern alternatives (e.g., Symfony’s EventDispatcher).Common component, or are there modern alternatives (e.g., symfony/collection, league/glide for media)?Collection, Str, HttpClient)?php-http/client)?GuzzleHttp\Psr7 for HTTP utilities?Common component is not designed for Laravel’s ecosystem:
bind()/singleton() support; manual instantiation would be required.Events service conflicts with Guzzle 3’s EventManager.Guzzle\Common\Http\Message is incompatible with PSR-7 (psr/http-message).polyfill packages (e.g., ext-json for JSON handling).symfony/process for IPC.composer.json with:
"repositories": [{"type": "vcs", "url": "https://github.com/guzzle/guzzle.git"}],
"require": {"guzzle/guzzle": "3.9.5"}
composer.json:
"autoload": {"psr-4": {"App\\": "app/", "Guzzle\\Common\\": "vendor/guzzle/guzzle/src/Guzzle/Common/"}}
// app/Facades/Guzzle3.php
namespace App\Facades;
use Guzzle\Common\Collection as GuzzleCollection;
class Guzzle3 extends \Illuminate\Support\Facades\Facade {
protected static function getFacadeAccessor() { return GuzzleCollection::class; }
}
Client is not PSR-18 compliant. Use Laravel’s HttpClient for new development.Collection lacks Laravel’s magic methods (e.g., pluck(), where()). Prefer Illuminate\Support\Collection.EventManager conflicts with Laravel’s Events. Use Laravel’s dispatch() instead.ext-curl, ext-json), increasing attack surface.ext-json in PHP 5.6).HttpMessage.goto, lack of type hints).How can I help you explore Laravel packages today?