Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 8, 2024 via composer

guzzlehttp/promises 2.0.2

Guzzle promises library
Package summary
Share
0
issues
1
license
1
MIT
Package created
25 Feb 2015
Version published
3 Dec 2023
Maintainers
4
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
guzzlehttp/promises@2.0.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of guzzlehttp/promises 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does guzzlehttp/promises do?

The Guzzle Promises package provides a Promises/A+ implementation that handles promise chaining and resolution iteratively. Thus, it allows for infinite promise chaining while maintaining the stack size constant.

How do you use guzzlehttp/promises?

You can install and utilize 'guzzlehttp/promises' in your PHP project by following these steps:

  1. Install the package via composer with the command:
composer require guzzlehttp/promises
  1. Next, import the Promise class from the GuzzleHttp\Promise namespace into your PHP script.

  2. After importing, you can create a new promise using the 'new' keyword and Promise constructor.

  3. Then, you can use methods like 'then', 'wait', 'cancel', 'getState', 'resolve', and 'reject' to interact with your Promise.

Below is a basic usage example:

use GuzzleHttp\Promise\Promise;

$promise = new Promise();
$promise->then(
    // $onFulfilled
    function ($value) {
        echo 'The promise was fulfilled.';
    },
    // $onRejected
    function ($reason) {
        echo 'The promise was rejected.';
    }
);

Here is an example of resolving a promise:

use GuzzleHttp\Promise\Promise;

$promise = new Promise();
$promise
    ->then(function ($value) {
        // Return a value and don't break the chain
        return "Hello, " . $value;
    })
    ->then(function ($value) {
        echo $value;
    });

$promise->resolve('reader.');  //Will output "Hello, reader."

Where are the guzzlehttp/promises docs?

The documentation for Guzzle Promises can be found in the README file of its GitHub repository. The documentation provides adequate information like package features, API reference, version guidance, installation and usage instructions, and highlights on key implementation notes.