Add ReactPhp client for non-blocking GraphQL calls#137
Open
Add ReactPhp client for non-blocking GraphQL calls#137
Conversation
Extracted from https://gitlab.mll/services/sysmex/-/merge_requests/96 where it was validated in production. Generic implementation structurally identical to the Guzzle client, using react/http Browser with React\Async\await(). 🤖 Generated with Claude Code
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a ReactPHP-based Sailor HTTP client to enable GraphQL requests from within ReactPHP applications, aligning the implementation with existing built-in clients.
Changes:
- Introduces
Spawnia\Sailor\Client\ReactPhpusingreact/http’sBrowserandReact\Async\await(). - Adds unit tests covering basic requests, variables, and non-200 response handling.
- Updates dependencies/suggestions and documents the new built-in client in the README.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Client/ReactPhp.php |
Adds a new ReactPHP-backed client implementation conforming to the existing Client interface. |
tests/Unit/Client/ReactPhpTest.php |
Adds unit tests validating request payloads and error behavior for the new client. |
composer.json |
Adds ReactPHP packages to require-dev and suggest for the new client. |
README.md |
Mentions the new ReactPhp client in the built-in client list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
react/async:^4 requires PHP >= 8.1, so remove it before composer install in CI for PHP 7.4/8.0. The test skips gracefully via @requires when the packages are not available. Also add composer require snippet for the ReactPHP client in the README installation section. 🤖 Generated with Claude Code
With lowest dependencies, react/async await() returns mixed instead of the generic type, causing a type mismatch on fromResponseInterface(). reportUnmatchedIgnoredErrors is already false so this is harmless when running with highest dependencies. 🤖 Generated with Claude Code
🤖 Generated with Claude Code
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.
Summary
Spawnia\Sailor\Client\ReactPhp— a non-blocking GraphQL client usingreact/httpBrowser withReact\Async\await()Test plan
vendor/bin/phpunit tests/Unit/Client/ReactPhpTest.php)🤖 Generated with Claude Code