PHP Luminova: Fulfilled Promise Object
Fulfield promise object represents an already completed promise. Use Luminova’s Fulfilled Promise to simplify promise handling.
The Fulfilled class represents a promise that is already resolved with a known value.This is helpful when you want to return a precomputed result as a promise, without additional asynchronous logic.
Class Definition
- Class Namespace:
Luminova\Promise\Fulfilled - Implements: \Luminova\Interface\PromiseInterface
constructor
Creates a promise that is already fulfilled (resolved).
public __construct(mixed $value)Parameters
| Parameter | Type | Description |
|---|---|---|
$value | mixed | The value used to immediately resolve the promise. |
Usage
use Luminova\Promise\Fulfilled;
$promise = new Fulfilled('Resolved Value');
$promise->then(function ($value) {
echo "Resolved: " . $value; // Output: Resolved: Resolved Value
});