Releases: Thavarshan/fetch-php
Releases · Thavarshan/fetch-php
v2.0.3
Added
- Support all PHP
8.x
versions
Changed
- Updated dependencies
- Updated dev dependencies
Full Changelog: 2.0.2...2.0.3
v2.0.2
Added
- Add Laravel Pint by @patinthehat in #8
- Add
isAsync
method toClientHandler
Changed
- Update
async
method to accept arguments
New Contributors
- @patinthehat made their first contribution in #8
Full Changelog: 2.0.1...2.0.2
v2.0.1
Changed
- Refactor
withBody
method inClientHandler
to only accept array arguments and encode given arguments to json string when called - Update documentation and fix typos
v2.0.0
Added
- VitePress Documentation: Introduced a new VitePress documentation site, including comprehensive API reference, examples, and guides. The site is accessible under the
./docs/
directory and deployable on Netlify. - Async Functionality: Introduced a new async functionality using
async()
function powered by PHP Fibers for true asynchronous operations. This provides a modern, JavaScript-likeasync/await
syntax for handling non-blocking requests. - Fluent API for HTTP Requests: Added support for a fluent, chainable API inspired by Laravel’s HTTP client. Methods like
withHeaders()
,withBody()
,withToken()
, and others allow for more intuitive and flexible request building. - Task Lifecycle Management: Introduced
Matrix
-powered task lifecycle management, allowing tasks to be paused, resumed, canceled, and retried for asynchronous requests. - Retry Logic with Exponential Backoff: Added customizable retry logic for both synchronous and asynchronous requests, allowing for retries with exponential backoff in case of network failures.
Changed
- Refactor of
fetch()
Function: Refactored the corefetch()
function to support both synchronous and asynchronous requests seamlessly. Now supports direct chaining of promises withthen()
andcatch()
for async requests. - Improved Error Handling: Enhanced error handling to provide better control over exceptions during both sync and async requests. Introduced customizable error handlers and improved promise rejection management.
- Response Class Overhaul: The
Response
class has been revamped to better handle different response formats, including JSON, text, binary data (array buffer), and streams. This improves the handling of diverse response types. - Expanded Guzzle Configuration Options: The package now exposes all of Guzzle’s configuration options directly via the
ClientHandler
, including proxy settings, cookies, redirects, and SSL certificates.
Removed
- Deprecated
fetchAsync
Method: ThefetchAsync
function has been fully removed, replaced by the newasync()
helper function. This provides better async handling and aligns with the new architecture based on PHP Fibers. - Symfony
Response
Dependency: Completely removed the dependency on Symfony’sResponse
class in favor of Guzzle’s PSR-7 compliantResponse
implementation. This reduces the package size and simplifies the dependencies.
Fixed
- Laravel 10 Compatibility Enhancements: Improved compatibility with Laravel 10 and Symfony 6.x by resolving issues related to HTTP foundation conflicts. The package now supports a wider range of Symfony and Laravel versions without dependency clashes.
- Async Error Handling: Fixed issues with async request error handling, ensuring that promises are properly resolved or rejected with meaningful exception messages.
- Persistent Guzzle Client Instances: Fixed an issue where a new Guzzle client was instantiated for every request. The Guzzle client is now reused efficiently across both sync and async operations.
v1.2.0
Added
- Guzzle PSR-7 Response Support: Introduced the
guzzlehttp/psr7
library for managing HTTP responses, providing more flexibility and aligning with PSR-7 standards. - Enhanced Error Handling: Improved error handling for both synchronous and asynchronous requests using Guzzle's
RequestException
. - New README Documentation: Updated the README to reflect the changes in response handling and usage of the
guzzlehttp/psr7
response.
Changed
- Refactor Response Class: The
Response
class now extendsguzzlehttp/psr7\Response
instead of Symfony'sResponse
, reducing dependency overhead and improving compatibility with PSR-7. - HTTP Request Handling: Refactored the
Http
class to ensure seamless request handling with the newguzzlehttp/psr7
response model. - Removed Symfony Response Dependency: Dropped Symfony's
Response
class in favor of the more lightweight and standardguzzlehttp/psr7
.
Fixed
- Laravel 10 Compatibility: Addressed compatibility issues with Laravel 10 by ensuring the package can work with Symfony 6.x versions while allowing flexibility for future upgrades.
- Composer Dependency Conflicts: Resolved conflicts with Symfony’s HTTP Foundation, ensuring compatibility for projects that depend on specific versions of Symfony and other packages.
- Asynchronous Error Handling: Fixed issues related to handling exceptions in asynchronous requests, ensuring proper error handling and promise resolution.
v1.1.1
Changed
- Updated Composer Dependencies:
Thesymfony/http-foundation
dependency has been updated to support versions^6.0 || ^7.0
, ensuring compatibility with Laravel 10 and future versions. This change allows smooth integration with Laravel 9.x, 10.x, and future Laravel versions without version conflicts. - Enhanced Test Suite for Compatibility:
The GitHub Actions test matrix has been expanded to test against Laravel 9.x, 10.x, and 11.x, ensuring future compatibility with new Laravel releases.
Fixed
- Compatibility Issue with Laravel 10:
The package had an installation conflict when used with Laravel 10 due to outdatedsymfony/http-foundation
version constraints. This release resolves the issue, allowing users to install the package without dependency conflicts in Laravel 10 environments.
v1.1.0
Changed
Http
Class: The HTTP request handling has been abstracted away into a newHttp
class, improving the overall structure of the library and allowing for cleaner, centralized management of requests via Guzzle.- Guzzle Client Reuse: The Guzzle client is now instantiated as a singleton, meaning it is created once and reused across all HTTP requests. This change improves the performance of the library when making multiple requests.
- Deprecation of
fetchAsync
: ThefetchAsync
method is now deprecated in favor offetch_async
. A deprecation warning has been added to guide users to transition to the new method.
Fixed
- Guzzle Client Instantiation Issue: Resolved an issue where the Guzzle client was instantiated for every HTTP request, leading to performance inefficiencies. Now, the client is reused across requests, reducing overhead.
v1.0.0
Initial release.