Add support for custom transport injection - #76
Merged
Conversation
neSpecc
approved these changes
Aug 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for injecting a custom transport into the Hawk catcher initialization flow, allowing users to avoid the built-in cURL transport (and ext-curl) when desired.
Changes:
- Added
Options::DEFAULT_URLand a newtransportoption with runtime validation againstTransportInterface. - Updated
Catcherto use an injected transport when provided, otherwise defaulting toCurlTransport. - Deprecated the built-in
GuzzleTransportwith fail-fast behavior and documented custom transport usage; movedext-curlfromrequiretosuggest.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/OptionsTest.php | Updates default URL assertion; should also cover the new transport option behavior. |
| src/Transport/GuzzleTransport.php | Marks transport as deprecated and fail-fast (but currently has a signature compatibility issue). |
| src/Options.php | Introduces DEFAULT_URL and the transport option with validation + accessor. |
| src/Catcher.php | Uses injected transport when provided, otherwise falls back to CurlTransport. |
| README.md | Documents custom transport injection with a Guzzle-based example. |
| composer.json | Moves ext-curl to suggest and bumps package version. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+19
to
20
| $this->assertEquals(Options::DEFAULT_URL, $options->getUrl()); | ||
| $this->assertEquals(error_reporting(), $options->getErrorTypes()); |
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.
Adds support for passing a custom transport during
Catcher::init().Changes
transportoption toOptionsTransportInterfaceCatcherwhen provided, otherwise fall back toCurlTransportOptions::DEFAULT_URLfor the default Hawk endpointext-curlfromrequiretosuggest, since curl is only required for the default transportGuzzleTransportas deprecated and fail-fast because it is not implementedNotes
The built-in
GuzzleTransportremains for backward compatibility, but it is deprecated. Users should provide their ownTransportInterfaceimplementation.The default
CurlTransportstill requiresext-curl.