v3.2.2 - 2025-05-19
- "Fatal error: Uncaught Error: Interface
Psr\Log\LoggerAwareInterfacenot found" closes #21
v3.2.1 - 2025-05-17
- Updated documentation
- Updated dependencies
v3.2.0 - 2025-05-16
- Added tests for various HTTP methods (GET, POST, PUT, DELETE, PATCH, OPTIONS) with appropriate assertions.
- Simplified
ManagesRetriesTestby using a mock class for retry-logic testing. - Consolidated tests for retryable status codes and exceptions into a single method.
- Updated
PerformsHttpRequestsTestto useGuzzleHttpclient mocks for more accurate request simulation. - Enhanced exception-handling tests to verify error messages and retry behaviour.
- Removed unnecessary reflection methods and streamlined test setup.
- Improved back-off delay calculations in retry tests to ensure correct timing.
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/3.1.1...3.2.0
v3.1.1 - 2025-05-16
- Implemented the missing
finalizeRequest()method in thePerformsHttpRequeststrait. This method centralizes request finalization logic, enabling internal shortcut methods likeget(),post(), etc., to function correctly.
- Internal shortcut HTTP methods (
get(),post(),put(), etc.) inPerformsHttpRequestsnow route through the newly addedfinalizeRequest()method for consistent request handling.
- Fixed a fatal error caused by calling an undefined
finalizeRequest()method inClientHandler. The missing method has now been properly defined and implemented.
v3.1.0 - 2025-05-10
-
PSR-18 Client:
Fetch\Http\Clientnow implementsPsr\Http\Client\ClientInterfacefor drop-in interoperability. -
Fluent Request Builder: Chainable helpers on
ClientHandlerfor headers, query params, JSON/form/multipart bodies, bearer token, basic auth, timeouts, redirects, cookies, proxy, certificates. -
Async/Promise Support: Built-in ReactPHP-style promises (
async(),await(),all(),race(),any(),sequence()), with->async()toggle andwrapAsync()/awaitPromise()helpers. -
Automatic Retries: Configurable max retries, retry delay, exponential backoff with jitter, and retry-on-status (408, 429, 5xx) or exceptions (
ConnectException). -
PSR-3 Logging: Optional
LoggerInterfaceinjection onClientandClientHandlerwith info/debug/error logs and sensitive-data masking for retries, requests, and responses. -
Immutable PSR-7 Extensions:
Fetch\Http\Requestextends Guzzle’s PSR-7Requestwith immutability traits and JSON/form/multipart constructors.Fetch\Http\Responseextends Guzzle’s PSR-7Responsewith buffered body, array-access to JSON payloads, and helpers:->json(),->text(),->xml(),->blob(),->arrayBuffer(), status inspectors, etc.
-
Enums for Safety:
Fetch\Enum\Method,ContentType, andStatusenums for validating methods, content types, and status codes. -
Test Helpers:
ClientHandler::createMockResponse()andcreateJsonResponse()to easily stub HTTP responses in unit tests.
- Consolidated Handler Traits: Core behavior refactored into six concerns (
ConfiguresRequests,HandlesUris,ManagesPromises,ManagesRetries,PerformsHttpRequests,SendsRequests) for clearer separation of URI handling, retries, promises, and request dispatch. - Unified Fetch API:
Client::fetch()now returns either aResponseInterfaceor the handler for method chaining, replacing older ad-hoc patterns. - Error-handling Alignment: Top-level
Client::sendRequest()now throws standardizedNetworkException,RequestException, orClientExceptioninstead of rawRuntimeException. - Default Options Management: Moved default method, headers, and timeout into
ClientHandler::$defaultOptionswith newgetDefaultOptions()andsetDefaultOptions(). - Guzzle Configuration:
ClientHandlernow reuses a single Guzzle client instance withRequestOptions::HTTP_ERRORSdisabled (handling errors internally) andCONNECT_TIMEOUTmapped from handler timeout.
- None
v3.0.0 - 2025-05-04
-
True Asynchronous Support: Completely reimplemented asynchronous functionality using Matrix’s PHP Fiber-based library.
-
JavaScript-like Syntax: Added support for JavaScript-like async/await patterns with
async()andawait()functions. -
Promise-based API: Introduced a clean Promise interface with
then(),catch(), andfinally()methods. -
Concurrent Request Helpers: Added support for managing multiple concurrent requests with
all(),race(), andany()functions. -
Task Lifecycle Management: Implemented proper task lifecycle control (start, pause, resume, cancel, retry).
-
Enhanced Error Handling: Added improved error handling with customizable error handlers.
-
New Helper Methods:
wrapAsync(): For wrapping callables in async functionsawaitPromise(): For awaiting promise resolution
- New Matrix Integration: Migrated from legacy
AsyncHelperto the new Matrix Fiber-based promises. - Return Type Changes: Updated method signatures to use union types (
ResponseInterface|PromiseInterface). - Simplified API: Streamlined the API to match JavaScript’s fetch pattern more closely.
- Improved Retry Logic: Enhanced retry mechanisms for both synchronous and asynchronous requests.
- Updated Documentation: Completely revised documentation to reflect the new async patterns.
- AsyncHelper Class: Removed the legacy
AsyncHelperclass in favor of direct Matrix integration.
- Promise Handling: Fixed various issues with Promise resolution and rejection.
- Retry Mechanism: Fixed retry logic to properly handle both network and server errors.
- Error Propagation: Improved how errors are propagated through Promise chains.
- Event Loop Management: Fixed event loop management for proper async task execution.
v2.0.6 - 2025-05-03
- Added
withQueryParameter()method for adding a single query parameter. - Added
withJson()method as a convenient way to set JSON request bodies. - Added
withFormParams()andwithMultipart()helper methods for form submissions. - Added
configurePostableRequest()helper method to standardize request body handling.
- Enhanced
withBody()method to support multiple content types (JSON, form-encoded, multipart). - Improved
post()andput()methods to properly handle different content types. - Improved retry mechanism with exponential backoff and jitter for better reliability.
- Enhanced error handling to be more selective about which errors trigger retries.
- Fixed query parameter handling to properly merge with existing parameters instead of overwriting.
- Fixed URL construction in
getFullUri()to correctly append query parameters. - Fixed retry logic to perform exactly the specified number of retries (not one extra).
- Fixed duplicate implementation of
isRetryableError()method. - Fixed retry failure detection to properly identify the last retry attempt.
v2.0.5 - 2025-03-30
getOptions(),getHeaders(),hasHeader(string $header), andhasOption(string $option)methods onClientHandler.
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/v2.0.4...v2.0.5
v2.0.4 - 2025-03-30
- Support for setting a single request header via
withHeader()inClientHandler. withToken(string $token): self,withAuth(string $username, string $password): self, andwithHeader(string $header, mixed $value): selfmethods onClientHandler.- Added
laravel/pintas a dev dependency.
- Bumped
composer.jsonto 2.0.4. - Bumped
dependabot/fetch-metadatafrom 2.2.0 to 2.3.0. - README syntax fix.
- Restored
jerome/matrixandpsr/http-messagedependencies.
- @tresbach in Thavarshan/fetch-php#14
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/v2.0.3...v2.0.4
v2.0.3 - 2024-12-06
- Support for all PHP 8.x versions.
- Updated dependencies and dev-dependencies.
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/v2.0.2...v2.0.3
v2.0.2 - 2024-10-19
- Added Laravel Pint integration.
isAsync()method onClientHandler.
- Updated
async()method to accept arguments.
- @patinthehat in Thavarshan/fetch-php#8
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/v2.0.1...v2.0.2
v2.0.1 - 2024-10-03
- Refactored
withBody()inClientHandlerto accept only arrays and JSON-encode them. - Documentation and typo fixes.
v2.0.0 - 2024-09-30
- VitePress documentation site under
./docs/. - PHP-Fiber-powered
async()for JavaScript-like async/await. - Fluent, chainable HTTP API (headers, body, token, auth, etc.).
- Task lifecycle control (pause, resume, cancel, retry).
- Retry logic with exponential backoff.
- Refactored core
fetch()for seamless sync/async. - Enhanced error handling and promise rejection.
- Overhauled
Responseclass for JSON, text, binary, and streams. - Exposed Guzzle options (proxy, cookies, redirects, SSL).
- Deprecated
fetchAsyncmethod. - Symfony
Responsedependency.
- Laravel 10 / Symfony 6 compatibility.
- Async error handling.
- Persistent Guzzle client reuse.
v1.2.0 - 2024-09-27
- Guzzle PSR-7 support via
guzzlehttp/psr7. - Improved error handling with Guzzle’s
RequestException. - Updated README for PSR-7 usage.
Responsenow extendsguzzlehttp/psr7\Response.- Refactored HTTP class for PSR-7 compliance.
- Removed Symfony
Responsedependency.
- Laravel 10 compatibility.
- Composer dependency conflicts.
- Async exception handling.
v1.1.1 - 2024-09-25
- Updated
symfony/http-foundationto^6.0 || ^7.0. - Expanded GitHub Actions test matrix for Laravel 9–11.
- Resolved Laravel 10 install conflict.
v1.1.0 - 2024-09-24
- Abstracted HTTP handling into a new
Httpclass. - Guzzle client reused as a singleton.
- Deprecated
fetchAsyncin favor offetch_async.
- Single-instance Guzzle instantiation.
Initial release.
v3.2.2 - 2025-05-19
- "Fatal error: Uncaught Error: Interface
Psr\Log\LoggerAwareInterfacenot found" closes #21
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/3.2.1...3.2.2
v3.2.1 - 2025-05-17
- Updated documentation
- Updated dependencies
Full Changelog: https://github.com/Thavarshan/fetch-php/compare/3.2.0...3.2.1