Use guzzlehttp/psr7 instead of symfony/http-foundation #6
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.
Purpose
This PR implements significant refactors to the
Fetch PHP
library, specifically addressing the transition from using Symfony'sResponse
class toguzzlehttp/psr7
for managing HTTP responses. This change improves compatibility and reduces the dependency footprint of the library. Additionally, the README has been updated to reflect these changes, ensuring that documentation is consistent with the current implementation. This update resolves compatibility issues reported in Laravel 10 projects and future-proofs the package with more flexible response handling.Related Issues: [#issue-link] (if applicable)
Approach
The primary focus of this change is refactoring the core
Response
class. The library now extends Guzzle'sPsr7\Response
, replacing the SymfonyResponse
class. This adjustment simplifies the response handling process while maintaining the core functionality users expect from Fetch PHP. All available response methods (e.g.,json()
,text()
,statusText()
) have been adapted to ensure compatibility with this new architecture. Furthermore, the README was updated to document these changes clearly and concisely for developers using the library.Key changes include:
Response
class to extendguzzlehttp/psr7
instead of Symfony'sResponse
.Open Questions and Pre-Merge TODOs
Response
to ensure compatibility with the new response class.Learning
This update was based on research into transitioning from Symfony
Response
to PSR-7 standards usingguzzlehttp/psr7
. The goal was to simplify response handling and reduce dependencies, while maintaining the flexibility and feature set that Fetch PHP users are accustomed to. This required an in-depth understanding of both Symfony and Guzzle's HTTP components, as well as maintaining backward compatibility for existing users.