Promise¶
A promise is a programming construct used in asynchronous programming to handle the results or errors of an asynchronous operation that may not have completed yet. It allows to write code that can continue executing while waiting for the completion of a long-running task, such as making an HTTP request or querying a database.
Promises follow the concept of promises in the context of the Promises/A+ specification, which is a widely adopted standard for asynchronous programming in many programming languages.
In PHP, promises are commonly used with libraries or frameworks that provide asynchronous functionality, such as Guzzle for making HTTP requests or ReactPHP for building asynchronous applications.
See also Promises in PHP, Using JavaScript-style Promises in PHP and Pointless Promises in PHP.
Related : Asynchronous, Fibers, Cancellation, Future
Related packages : pccomponentes/ddd, guzzle/promises, react/promises, php-http/promise