guzzlehttp/promises
Iterative promise chaining for infinite async operations with Guzzle HTTP. Supports Promises/A+ compliance, coroutine-style await via Coroutine::of(), and synchronous wait() method. Cancel promises mid-execution and handle rejection/fulfillment callbacks cleanly. Works with any object with a then()...
Architecture fit: This package remains a foundational async primitive for PHP applications, particularly within the Guzzle ecosystem. Its seamless integration with Laravel's HTTP client (which depends on Guzzle) makes it ideal for asynchronous HTTP requests and custom async workflows. The Promises/A+ compliance ensures compatibility with standard async patterns, and the recent fix in v2.4.1 (coroutine cancellation handling) further solidifies its reliability in edge cases.
Integration feasibility: High feasibility persists due to Composer-based installation and Laravel's existing Guzzle dependency. No additional configuration is required beyond requiring the package. Direct usage for async operations remains minimal, though the coroutine fix may necessitate review of cancellation-heavy workflows (e.g., long-running tasks with explicit cancellation).
Technical risk: Low risk, but slightly elevated for applications relying on coroutine cancellation. The package is mature (7720+ stars), MIT-licensed, and maintains clear version guidance. PHP version compatibility remains unchanged (v2.x requires >=7.2.5, <8.6). Potential risks persist if synchronous waits are misused in high-throughput scenarios without proper task queue management. The v2.4.1 fix mitigates a niche but critical edge case for coroutine-heavy applications.
Key questions:
Stack fit: Ideal for Laravel applications using Guzzle for HTTP clients. Also suitable for custom async tasks requiring non-blocking operations (e.g., parallel API calls). The package fits seamlessly into Laravel's service container without conflicts. The v2.4.1 fix ensures stability for coroutine cancellation, which may be relevant for advanced async workflows.
Migration path: If replacing another promise library (e.g., ReactPHP), interoperability remains straightforward via then method compatibility. For new projects, simply require and use. Existing Guzzle-based code already leverages this package, so no migration is needed for HTTP operations. The coroutine fix may require validation of cancellation logic in custom async workflows.
Compatibility: Fully compatible with ReactPHP promises and other then-compatible libraries. Works with Laravel's event system when task queues are integrated. PHP 7.2.5+ required for the latest version. The v2.4.1 fix does not introduce breaking changes but may impact cancellation behavior in edge cases.
Sequencing:
new Promise() or FulfilledPromise/RejectedPromise.then(), handling resolution/rejection.Maintenance: Minimal overhead. Updates are handled via Guzzle dependency. The v2.4.1 fix reduces the risk of memory leaks or dangling coroutines in cancellation scenarios, improving long-term stability.
Support: Existing support channels (GitHub issues, documentation) remain unchanged. The fix may require additional testing for applications with complex coroutine workflows, but no new support burden is introduced.
Scaling: No impact on scaling. The fix optimizes resource cleanup in cancellation scenarios, which may indirectly improve performance in high-concurrency environments by preventing leaks.
Failure modes: The v2.4.1 fix mitigates a previously undocumented edge case where settled coroutines might not release resources properly during cancellation. Applications relying on explicit coroutine cancellation should verify behavior post-upgrade. Otherwise, failure modes remain unchanged.
Ramp-up: No additional training is required. The fix is transparent to most users, but teams using coroutine cancellation should review their workflows. Documentation and examples remain sufficient for standard use cases.
How can I help you explore Laravel packages today?