PHPackages                             krakjoe/promises - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. krakjoe/promises

ActiveLibrary[Queues &amp; Workers](/categories/queues)

krakjoe/promises
================

Promises in PHP using pthreads v1.0.0+

v1.0.3(11y ago)65695PHPPHP

Since Mar 8Pushed 10y ago6 watchersCompare

[ Source](https://github.com/krakjoe/promises)[ Packagist](https://packagist.org/packages/krakjoe/promises)[ Docs](http://pthreads.org/)[ RSS](/packages/krakjoe-promises/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

promises
========

[](#promises)

Promises in PHP using **pthreads v1.0.0+**

Promise Manager
===============

[](#promise-manager)

The Promise Manager represents a pool of threads used to fulfill promises in parallel.

The only public API for the `PromiseManager` is the constructor:

```
public PromiseManager::__construct($size = 4, $worker = \Worker::class, $ctor = [])

```

See `Pool::__construct` in the PHP manual.

Promise
=======

[](#promise)

A `Promise` represents a promise to execute the public interface of a `Promisable` at some time in the future:

```
public Promise::__construct(PromiseManager $manager, Promisable $promisable)

```

A `Promise` provides the ability to schedule the subsequent execution of the public interface of a `Thenable`.

```
public Promise Promise::then(Thenable $then)

```

Interfaces
==========

[](#interfaces)

IPromisable

```
public void IPromisable::onFulfill();

```

IThenable

```
public void IThenable::onFulfilled(Promisable $promised);
public void IThenable::onError(Promisable $promised);

```

Notes
=====

[](#notes)

Exceptions thrown by `Promisable`, or `Thenable` objects will be caught and bubble up to invoke subsequent `Thenable::onError`.

```
$manager = new PromiseManager();
$promise =
	new Promise($manager, new CalculateTheMeaningOfLife());
$promise
	->then(
		new AddTwo($promise))
	->then(
		new PrintMeaning($promise));

$manager->shutdown();
```

This is a work in progress
--------------------------

[](#this-is-a-work-in-progress)

Note that, this is a work in progress, that does not aim for maximum compatibility with any established standard but rather an easy to use implementation, that is compatible with and takes full advantage of pthreads.

While reading the API, remember everything you read other than `PromiseManager` is a *pthreads* object

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 92.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~91 days

Total

4

Last Release

4170d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a53e08d9e444763eaca5611e49ff1403e8e0803a648b6cbd0e3a0d33430a2ff4?d=identicon)[krakjoe](/maintainers/krakjoe)

---

Top Contributors

[![krakjoe](https://avatars.githubusercontent.com/u/2236138?v=4)](https://github.com/krakjoe "krakjoe (37 commits)")[![Danack](https://avatars.githubusercontent.com/u/1505719?v=4)](https://github.com/Danack "Danack (1 commits)")[![draco2003](https://avatars.githubusercontent.com/u/196891?v=4)](https://github.com/draco2003 "draco2003 (1 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (1 commits)")

---

Tags

promisespthreads

### Embed Badge

![Health badge](/badges/krakjoe-promises/health.svg)

```
[![Health](https://phpackages.com/badges/krakjoe-promises/health.svg)](https://phpackages.com/packages/krakjoe-promises)
```

###  Alternatives

[react/promise

A lightweight implementation of CommonJS Promises/A for PHP

2.5k361.9M563](/packages/react-promise)[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[amphp/parser

A generator parser to make streaming parsers simple.

14952.8M16](/packages/amphp-parser)[amphp/serialization

Serialization tools for IPC and data storage in PHP.

13451.1M18](/packages/amphp-serialization)[deliciousbrains/wp-background-processing

WP Background Processing can be used to fire off non-blocking asynchronous requests or as a background processing tool, allowing you to queue tasks.

1.1k409.8k6](/packages/deliciousbrains-wp-background-processing)[react/async

Async utilities and fibers for ReactPHP

2238.8M170](/packages/react-async)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
