- What is php-http/buzz-adapter used for?
- It is a PHP-HTTP adapter that bridges the Buzz HTTP client with HTTPlug and PSR-18 interfaces. Use it when an application or library expects a standard HTTP client but you want Buzz to handle the actual requests. It lets Buzz be swapped in without changing consuming code.
- How do I install php-http/buzz-adapter with Composer?
- Install it with Composer using composer require php-http/buzz-adapter. You also need a compatible Buzz client package available in your project. Composer will enforce the relevant PSR-18, HTTPlug, and Buzz version constraints.
- Does php-http/buzz-adapter work with Laravel?
- Yes, because Laravel can resolve PSR-18 and HTTPlug clients through service container bindings. You can bind the Buzz adapter to Psr\Http\Client\ClientInterface or the relevant HTTPlug interface. Laravel’s default HTTP client is Guzzle, so this adapter is for apps that specifically want Buzz.
- How do I configure Buzz as the HTTP client in Laravel?
- Create a Buzz client or browser, wrap it with the adapter, and bind it to the PSR-18 client interface in a service provider. Packages that depend on PSR-18 discovery or container resolution will then use Buzz. Avoid binding conflicting HTTP clients in the same application.
- Which Laravel versions support php-http/buzz-adapter?
- The adapter is framework-agnostic, so Laravel support depends on whether your app or packages can resolve PSR-18 or HTTPlug clients. Modern Laravel releases make this straightforward through service container bindings, while older releases may need manual HTTPlug wiring. Always check Composer constraints for PHP, Buzz, and the adapter.
- What is the difference between HTTPlug and PSR-18 in this adapter?
- HTTPlug predates PSR-18 and defines its own HTTP client interfaces, while PSR-18 is the standardized HTTP client interface. The adapter lets Buzz satisfy both contracts, so packages using either can share the same Buzz-based transport. Prefer PSR-18 for new code unless a dependency still requires HTTPlug.
- Can I use php-http/buzz-adapter for testing HTTP requests?
- You can use it in integration tests to exercise real Buzz behavior, but unit tests should mock PSR-18 or HTTPlug interfaces instead. Laravel’s HTTP fake helpers target Laravel’s own HTTP client layer, so they may not intercept Buzz automatically. Use a mock client or adapter-level test double for deterministic tests.
- Is php-http/buzz-adapter suitable for production?
- It is suitable when you need Buzz’s transport behavior behind a standard HTTP client interface. Evaluate Buzz’s timeout, connection handling, TLS options, and middleware against your production requirements. Since it is an adapter, reliability depends mostly on how the underlying Buzz client is configured.
- What alternatives exist to php-http/buzz-adapter?
- Alternatives include Guzzle adapters such as php-http/guzzle7-adapter, Symfony HTTP Client adapters, and native PSR-18 clients. Choose based on the HTTP client you already operate and whether you need HTTPlug compatibility. If you do not need Buzz specifically, a maintained PSR-18 client may be simpler.
- Is php-http/buzz-adapter still maintained?
- Maintenance depends on the package’s release activity and the Buzz and PHP-HTTP ecosystem, so check Packagist and the repository for recent commits and supported versions. The adapter is small, but you should confirm compatibility with your PHP, Buzz, and Laravel versions. If it is dormant, pin versions and plan an alternative.