Download the PHP package async-interop/promise without Composer

On this page you can find all versions of the php package async-interop/promise. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package promise

Promise

The purpose of this specification is to provide a common interface for simple placeholder objects returned from async operations. This allows libraries and components from different vendors to create coroutines regardless of the placeholder implementation used. This specification is not designed to replace promise implementations that may be chained. Instead, the common interface may be extended by promise implementations.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

A Promise represents the eventual result of an asynchronous operation. Interaction with a Promise happens through its when() method, which registers a callback to receive either a Promise's eventual value, or reason for failure.

Promise is the fundamental primitive in asynchronous programming. It should be as lightweight as possible, as any cost adds up significantly.

This specification defines the absolute minimum for interoperable coroutines, which can be implemented in PHP using generators.

This specification does not deal with how a Promise should be created, succeed, or fail, as only the consumption of Promise is required to be interoperable.

For further design explanations and notes, please refer to the meta document.

Terminology

  1. Promise is an object implementing AsyncInterop\Promise and conforming to this specification.
  2. Value is any legal PHP value (including null), but not an instance of AsyncInterop\Promise.
  3. Error is any value that can be thrown using the throw statement.
  4. Reason is an error indicating why a Promise has failed.

States

A Promise MUST be in one of three states: pending, succeeded, failed.

A promise in … state  
pending
  • MAY transition to either the succeeded or failed state.
succeeded
  • MUST NOT transition to any other state.
  • MUST have a value which MUST NOT change.*
failed
  • MUST NOT transition to any other state.
  • MUST have a reason which MUST NOT change.*

A Promise is resolved once it either succeeded or failed.

Consumption

A Promise MUST implement AsyncInterop\Promise and thus provide a when() method to access its value or reason.

All callbacks registered before the Promise is resolved MUST be executed in the order they were registered after the Promise has been resolved. Callbacks registered after the resolution MUST be executed immediately.

The invocation of Promise::when() MUST NOT throw exceptions bubbling up from an $onResolved invocation. If one of the callbacks throws an Exception or Throwable, the Promise implementation MUST catch it and call AsyncInterop\Promise\ErrorHandler::notify() with the Exception or Throwable as first argument. The Promise implementation MUST then continue to call the remaining callbacks with the original parameters.

Registered callbacks MUST NOT be called from a file with strict types enabled (declare(strict_types=1)).

Error Handling

Uncaught exceptions thrown from callbacks registered to Promise::when() are forwarded to the ErrorHandler by Promise implementations. ErrorHandler::set() can be used to register a callable to handle these exceptions gracefully, e.g. by logging them. In case the handler throws again or is not set, an E_USER_ERROR is triggered. If a PHP error handler is set using set_error_handler and it throws, a short message is written to STDERR and the program exits with code 255. Thus, it's RECOMMENDED to set an error handler and ensure it doesn't throw, especially if the PHP error handler is set up to convert errors to exceptions.

Contributors


All versions of promise with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package async-interop/promise contains the following files

Loading the files please wait ....