devmachine/guzzle-client-bundle
guzzlehttp/guzzle) and seeks consistency in client configuration.ServiceProvider or Package structure.
ClientBuilder logic in a Laravel service provider to register Guzzle clients with shared configurations.DependencyInjection and Config components are not natively available in Laravel. Workarounds:
config() and app() bindings to mimic DI.Extension system with Laravel’s Package boilerplate.config/guzzle.php or environment variables.devmachine_guzzle namespace would need renaming or aliasing (e.g., guzzle-clients).ParameterBag, ContainerAware interfaces).Http::client())?spatie/laravel-guzzle-promise) that overlap with this bundle’s goals?Http::client() or standalone GuzzleHttp\Client. This bundle adds value if:
| Symfony Component | Laravel Equivalent | Adaptation Notes |
|---|---|---|
Extension |
ServiceProvider/Package |
Replace load() with register() |
ContainerBuilder |
Laravel’s Container |
Use app()->bind() or singleton() |
Configuration |
config/guzzle.php |
Convert YAML to PHP array |
ClientBuilder |
Custom Laravel service | Inject dependencies via constructor |
Http::macro('client', fn() => new Client()) may suffice.spatie/laravel-guzzle-promise for async support.Client instantiation, Http::client()).ClientBuilder to a Laravel service provider.guzzlehttp/guzzle version matches the bundle’s requirements (e.g., v7.x).// Example: Ensure auth middleware runs before logging
$client->getEmitter()->push(
Middleware::tap(fn($stack) => new AuthMiddleware()),
'auth'
);
config() system should support overriding bundle defaults (e.g., config(['guzzle.timeout' => 30])).ClientBuilder service provider.config/guzzle.php.Log::channel('guzzle')).README.laravel.md.php artisan guzzle:debug [client-name] # Hypothetical; would need custom implementation
Client is already efficient).Cache facade can store client configurations if needed.| Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Guzzle version mismatch | Breaking changes in API usage | Pin versions in composer.json |
| Middleware conflict | Requests fail silently | Add validation in ClientBuilder |
| Configuration corruption | Clients misbehave | Use Laravel’s config:cache validation |
| Dependency injection errors | Clients not registered | Health checks in bootstrap/app.php |
| Upstream Symfony updates | Adapted code breaks | Fork the bundle or reduce customizations |
guzzle-clients.md in the project wiki with:
How can I help you explore Laravel packages today?