v2.0.0
π Major Release: Complete Interface Redesign
Breaking Changes
- ClientInterface: sendRequestBatch() now returns ResponseBatchInterface instead of array
- New Interface Hierarchy: Complete redesign for better type safety and usability
- BatchItemInterface: Individual request/response pairs with getRequest(), isSuccess(), getResponse(), getException()
- ResponseBatchInterface: Batch container with utility methods (extends Countable)
- Exception Redesign: Clear exception hierarchy for access violations
- AccessExceptionInterface: Base interface extending Throwable
- ResponseUnavailableExceptionInterface: When accessing response on failed requests
- ExceptionUnavailableExceptionInterface: When accessing exception on successful requests
New Features
- Rich Utility Methods: isCompleteSuccess(), hasAnyFailures(), hasAnySuccesses(), getSuccessfulResults(), getFailedResults()
- Flexible Filtering: filter() method with callable predicates for custom result filtering
- Countable Interface: ResponseBatchInterface extends Countable for direct count() support
- Type Safety: Eliminated union types in favor of clean holder patterns
- Better Semantics: isSuccess() indicates transport success, not HTTP status codes
Migration Guide
Before (v1.x):
$responses = $client->sendRequestBatch($requests); // array of ResponseInterface
foreach ($responses as $response) {
// Handle response
}After (v2.0):
$batch = $client->sendRequestBatch($requests); // ResponseBatchInterface
// Check overall success
if ($batch->isCompleteSuccess()) {
foreach ($batch->getResults() as $item) {
$response = $item->getResponse();
// Handle successful response
}
} else {
// Handle mixed results
foreach ($batch->getSuccessfulResults() as $item) {
$response = $item->getResponse();
// Process successful responses
}
foreach ($batch->getFailedResults() as $item) {
$exception = $item->getException();
// Handle network failures
}
}
// Direct counting support
$totalRequests = count($batch);Full Changelog: v1.0.1...v2.0.0