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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpgt/async

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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

Promise-based non-blocking operations.

v1.0.3(1mo ago)03.1k↑275%1[1 PRs](https://github.com/PhpGt/Async/pulls)4MITPHPPHP &gt;=8.1CI passing

Since Jan 4Pushed 2w ago1 watchersCompare

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

READMEChangelog (5)Dependencies (10)Versions (19)Used By (4)

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();
```

Proudly sponsored by
====================

[](#proudly-sponsored-by)

[JetBrains Open Source sponsorship program](https://www.jetbrains.com/community/opensource/)

[![JetBrains logo.](https://camo.githubusercontent.com/b5639e7738c6dfae9fe3f3e20175570b7376ce2577a772e09c25c2d4f14bf86e/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a6574627261696e732e737667)](https://www.jetbrains.com/community/opensource/)

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance94

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~482 days

Total

5

Last Release

50d 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 (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

asyncasync-awaitasync-programmingasynchronousasynchronous-programmingno-aiphp-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

[pushbots/instapush-php

Instapush PHP Wrapper

201.8k](/packages/pushbots-instapush-php)

PHPackages © 2026

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