Use guzzlehttp/psr7 instead of symfony/http-foundation#6
Merged
Thavarshan merged 2 commits intomainfrom Sep 27, 2024
Merged
Conversation
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.
Purpose
This PR implements significant refactors to the
Fetch PHPlibrary, specifically addressing the transition from using Symfony'sResponseclass toguzzlehttp/psr7for 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
Responseclass. The library now extends Guzzle'sPsr7\Response, replacing the SymfonyResponseclass. 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:
Responseclass to extendguzzlehttp/psr7instead of Symfony'sResponse.Open Questions and Pre-Merge TODOs
Responseto ensure compatibility with the new response class.Learning
This update was based on research into transitioning from Symfony
Responseto 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.