Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 29, 2024 via composer

react/promise-timer v1.10.0

A trivial implementation of timeouts for Promises, built on top of ReactPHP.
Package summary
Share
0
issues
1
license
3
MIT
Package created
12 Aug 2015
Version published
20 Jul 2023
Maintainers
4
Total deps
3
Direct deps
2
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
3 Packages, Including:
react/event-loop@v1.5.0
react/promise@v3.2.0
react/promise-timer@v1.10.0
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

2
All Dependencies CSV
β“˜ This is a list of react/promise-timer 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
react/event-loopv1.5.039.55 kBMIT
prod
react/promisev3.2.0-MIT
prod

Visualizations

Frequently Asked Questions

What does react/promise-timer do?

The PHP package react/promise-timer provides a straightforward means to implementing timeouts for Promises, fortified with the power of ReactPHP. This lightweight library meticulously handles operations that take longer than desired. It also gives the functionality to create a new promise that executes in a specified time period. What's more, it presents the utility to automatically cancel pending operations experiencing delays, effectively ensuring efficient and smooth functioning of your applications.

How do you use react/promise-timer?

Having Composer installed, you can use the react/promise-timer package by installing it with the following command:

composer require react/promise-timer:^1.10

As per the PHP version you're running, this will install the latest supported version of react/promise-timer.

The library provides different timing functions and cancellation methods. Here are some examples on how to usage it:

use function React\Promise\Timer\timeout;

$promise = someFuncReturningPromise();
timeout($promise, 10.0)->then(function ($value) {
    // the operation finished in less than 10.0 seconds
});
use React\Promise\Timer;

$promise = someFuncReturningPromise();
Timer\timeout($promise, 10.0)->then(
    function ($value) {
        // the operation finished in less than 10.0 seconds
    },
    function ($error) {
        if ($error instanceof React\Promise\Timer\TimeoutException) {
            // the operation has failed due to a timeout
        } else {
            // the operation has failed due to some other error
        }
    }
);

You can also toggle the optional cancellation feature of the promise:

$promise = someFuncReturningPromise();
$timeout = Timer\timeout($promise, 10.0);

$timeout->cancel();

Where are the react/promise-timer docs?

The react/promise-timer documentation is hosted directly within the GitHub repository. All you need to know about its functionality and implementation is clearly elaborated in the ReadMe file of the official react/promise-timer GitHub repository. Navigate through the content to find specific instructions on usage, installation, tests execution, function descriptions along with code examples.