PHPackages                             phpgt/async - 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. phpgt/async

ActiveLibrary

phpgt/async
===========

Promise-based non-blocking operations.

v1.0.1(1y ago)02.1k↓68%1[3 PRs](https://github.com/PhpGt/Async/pulls)2MITPHPPHP &gt;=8.1CI passing

Since Jan 4Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/PhpGt/Async)[ Packagist](https://packagist.org/packages/phpgt/async)[ GitHub Sponsors](https://github.com/phpgt)[ RSS](/packages/phpgt-async/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (13)Used By (2)

Promise-based non-blocking operations.
======================================

[](#promise-based-non-blocking-operations)

To be able to run asynchronous code in PHP, a loop needs to run in the background to observe and dispatch events, and handle the resolution of promises.

This repository provides the concepts of a `Loop`, different `Timer` implementations and a publish-subscribe model for `Event` objects.

---

[ ![PHP.Gt/Async build status](https://camo.githubusercontent.com/31a5c621e416b6639edc56be73b0357a63da14f68e234dbb6acdb7de83ceaf2b/68747470733a2f2f62616467652e7374617475732e7068702e67742f6173796e632d6275696c642e737667)](https://github.com/PhpGt/Async/actions)[ ![PHP.Gt/Async code quality](https://camo.githubusercontent.com/875668ce58f0cdb1ab987329f3a6ac5a6f3d73254eadaea5c4318344ac75e4dd/68747470733a2f2f62616467652e7374617475732e7068702e67742f6173796e632d7175616c6974792e737667)](https://app.codacy.com/gh/PhpGt/Async)[ ![PHP.Gt/Async code coverage](https://camo.githubusercontent.com/5cceb288b80aae4ec84d2de3d15888511934b1463a9feb4ca678be31da56d940/68747470733a2f2f62616467652e7374617475732e7068702e67742f6173796e632d636f7665726167652e737667)](https://app.codacy.com/gh/PhpGt/Async)[ ![PHP.Gt/Async latest release](https://camo.githubusercontent.com/2de3ec25d2bba651fe2c55f60a819082febcd7b68d41720c26e1b784d8bcf4db/68747470733a2f2f62616467652e7374617475732e7068702e67742f6173796e632d76657273696f6e2e737667)](https://packagist.PhpGt/packages/PhpGt/Async)[ ![PHP.Gt/Async documentation](https://camo.githubusercontent.com/c8d42de205c5e114fe58310a1a7cd66c8888e6cb3d97802be61ffe3e7401977a/68747470733a2f2f62616467652e7374617475732e7068702e67742f6173796e632d646f63732e737667)](http://www.php.gt/Async)Example usage
-------------

[](#example-usage)

A loop with three individual timers at 1 second, 5 seconds and 10 seconds.

```
$timeAtScriptStart = microtime(true);

$timer = new IndividualTimer();
$timer->addTriggerTime($timeAtScriptStart + 1);
$timer->addTriggerTime($timeAtScriptStart + 5);
$timer->addTriggerTime($timeAtScriptStart + 10);

$timer->addCallback(function() use($timeAtScriptStart) {
	$now = microtime(true);
	$secondsPassed = round($now - $timeAtScriptStart);
	echo "Number of seconds passed: $secondsPassed", PHP_EOL;
});

$loop = new Loop();
$loop->addTimer($timer);
echo "Starting...", PHP_EOL;
$loop->run();
```

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance75

Regular maintenance activity

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~753 days

Total

3

Last Release

428d ago

Major Versions

v0.1.0 → v1.0.02023-01-19

PHP version history (2 changes)v0.1.0PHP &gt;=7.4

v1.0.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e42344b91ce4b91ab57875969f67a0a6a48de570a08bc65d673b06b72fd3a3f?d=identicon)[g105b](/maintainers/g105b)

---

Top Contributors

[![g105b](https://avatars.githubusercontent.com/u/358014?v=4)](https://github.com/g105b "g105b (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

asyncasync-awaitasync-programmingasynchronousasynchronous-programmingphp-asyncphpgt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpgt-async/health.svg)

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

###  Alternatives

[phpgt/fetch

Asynchronous HTTP client with promises.

3724.0k2](/packages/phpgt-fetch)

PHPackages © 2026

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