Skip to content

Add support for custom transport injection - #76

Merged
pavelzotikov merged 3 commits into
masterfrom
add-custom-transport-option
Aug 13, 2026
Merged

Add support for custom transport injection#76
pavelzotikov merged 3 commits into
masterfrom
add-custom-transport-option

Conversation

@pavelzotikov

Copy link
Copy Markdown
Contributor

Adds support for passing a custom transport during Catcher::init().

Changes

  • Add transport option to Options
  • Validate that custom transport implements TransportInterface
  • Use custom transport in Catcher when provided, otherwise fall back to CurlTransport
  • Add Options::DEFAULT_URL for the default Hawk endpoint
  • Move ext-curl from require to suggest, since curl is only required for the default transport
  • Mark built-in GuzzleTransport as deprecated and fail-fast because it is not implemented
  • Document custom transport usage with a Guzzle example

Notes

The built-in GuzzleTransport remains for backward compatibility, but it is deprecated. Users should provide their own TransportInterface implementation.

The default CurlTransport still requires ext-curl.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_URL and a new transport option with runtime validation against TransportInterface.
  • Updated Catcher to use an injected transport when provided, otherwise defaulting to CurlTransport.
  • Deprecated the built-in GuzzleTransport with fail-fast behavior and documented custom transport usage; moved ext-curl from require to suggest.

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 thread src/Transport/GuzzleTransport.php Outdated
Comment thread README.md
Comment on lines +19 to 20
$this->assertEquals(Options::DEFAULT_URL, $options->getUrl());
$this->assertEquals(error_reporting(), $options->getErrorTypes());
Comment thread README.md Outdated
@pavelzotikov
pavelzotikov merged commit 358ff5a into master Aug 13, 2026
5 checks passed
@pavelzotikov
pavelzotikov deleted the add-custom-transport-option branch August 13, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants