-
-
Notifications
You must be signed in to change notification settings - Fork 253
Add configurable HTTP Handler for logging, retries, and custom headers #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…gging, and retries - Introduced full HTTP handler documentation from scratch - Demonstrates flexible control, custom middleware, logging, and retry features - Includes examples for default and custom handlers
|
I understand this is a highly requested feature so at some point we need to bite bullet and do something. Between the various attempts of a PSR-18 complaint integration and this - what led you to this method? It seems we have more to manage with event emission vs like a tiny PSR-18 bridge - #127 (comment) Trying to understand pro/con. |
|
Thanks for the follow-up question! The PSR-18 bridge like laravel-http-psr18 does dispatch Laravel HTTP events, but it’s less flexible when developers want to extend behavior — for example, adding retry request, custom headers, or logging through Laravel’s familiar interfaces. In this package, the http client is created internally in the ServiceProvider and using just like (e.g., OpenAI::chat()) to maintain the zero-config experience developers expect. Maintenance: The handler itself is intentionally small and leverages Guzzle’s native middleware. In short, the handler approach provides first-class integration with the HTTP client ecosystem (Laravel Http events , request retries , custom headers via middleware) while keeping configuration optional and dependency-free. |
What: Add Configurable HTTP Handler for Logging, Retries, and Custom Headers
Description:
This pull request adds a configurable HTTP handler for logging, retries, custom headers, and more.
Instead of relying on a third-party HTTP bridge client, most features can be achieved using the HTTP handler itself.
Starter documentation - The starter documentation
Why this to be useful
Telescope,Pulseand othersloggingretry, with header and much moreWhat was changed
http_handleroption toconfig/openai.php, allowing developers to define custom handler class-string.ServiceProviderfor HTTP client to dynamically resolve the handler using:Related:
The previous PR : #172
#75
#127
#78