feat: support custom HTTP client injection#17
Open
Seraphim200001 wants to merge 1 commit intoopenapi:mainfrom
Open
feat: support custom HTTP client injection#17Seraphim200001 wants to merge 1 commit intoopenapi:mainfrom
Seraphim200001 wants to merge 1 commit intoopenapi:mainfrom
Conversation
Allow passing a pre-configured HTTP client (e.g. Guzzle) to the Client. This enables reuse of middleware stacks (e.g. Laravel retry/cache) instead of forcing the internal cURL transport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: #6
Allow passing a pre-configured HTTP client (e.g. Guzzle) to the Client. This enables reuse of middleware stacks (e.g. Laravel retry/cache) instead of forcing the internal cURL transport.
📋 Description
This PR adds support for injecting a custom HTTP client into the SDK Client.
Previously, all requests were executed via an internal cURL implementation. This made it impossible to reuse existing HTTP client configurations and middleware stacks (e.g. Laravel retry() or cache()), as they were bypassed entirely.
With this change, users can now provide a pre-configured HTTP client (such as Guzzle or any PSR-18 compatible client). This allows requests to be executed through the application's existing HTTP layer, enabling middleware reuse, connection pooling, and consistent configuration.
The default behavior remains unchanged: if no custom client is provided, the SDK continues to use its internal cURL transport.
This improves flexibility while keeping the SDK lightweight and framework-agnostic.
✨ Type of Change
🔍 Main Changes
or a PSR-18 compatible HTTP client (e.g. Guzzle)
🧪 Testing
./vendor/bin/phpunit)📝 Additional Notes
Added support for psr/http-client to allow integration with PSR-18 compatible HTTP clients (e.g. Guzzle)
No framework-specific dependencies were introduced
Guzzle support is implicit via PSR-18 and remains optional
Default cURL transport remains unchanged and is used when no custom client is provided
🔗 Related Issue
Closes #6
📸 Screenshots (if applicable)
✅ Checklist