1.

What are promises?

Answer»

Promises becomes very important when it comes to asynchronous COMMUNICATION and it also provides effective ways to manage resources.

  1. A PROMISE is an object that may produce a single value sometime time in the future: either a resolved value, or a reason that it’s not resolved (e.g., a network error OCCURRED). A promise may be in one of 3 possible states: fulfilled, rejected, or pending. Promise users can attach callbacks to handle the fulfilled value or the reason for rejection.
  2. It started with JS but has been implemented in variety of technologies including PHP.
  3. Some libraries we can USE to implement promises in PHP:
  4. https://github.com/guzzle/promises
  5. https://github.com/reactphp/promise


Discussion

No Comment Found