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

ActiveLibrary

sanderswang/async
=================

v1.0.0(8y ago)034PHP

Since Jun 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/sanderswang/Async)[ Packagist](https://packagist.org/packages/sanderswang/async)[ RSS](/packages/sanderswang-async/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Notice
======

[](#notice)

if in **WEB server** and want to do something **async**pls consider **fastcgi\_finish\_request()**

Async
=====

[](#async)

fork from `muyizixiu/Async` , (fix small bugs)

```
php 异步任务库
一个快速响应的web应用必然有很多繁重的异步任务去做，Async利用pnctl_fork创建异步进程，同时管理异步任务。

```

detai:

Install
-------

[](#install)

```
composer install sanderswang/async

```

Usage
-----

[](#usage)

#### common async task:

[](#common-async-task)

```
use Async/Async;
$async = new Async($redis_host,$redis_port,$redis_password,'/tmp/async);
$async->task(function($data){
    echo 'common Async' . "$data\n";
    doSomething();
}, 'common task');

```

do once, and then exit

#### domain and queue task:

[](#domain-and-queue-task)

domain.php

```
use Async/Async;
$a = new Async($redis_host,$redis_port,$redis_password,'/tmp/async');
//当任务不存在时创建任务
if(!$a->isTaskExists($task_name)){
    $a->task(function($data){
        echo 'hello Async'."$data\n";
        doSomething();
    },$task_name,true,true,'123');
}

```

a.php:

```
$a = new Async($redis_host,$redis_port,$redis_password,'/tmp/async');
for($i = 0;$i < 10;$i ++){
    sleep(2);
    $a->sendData($task_name, "这是我第$i个数据");
}

```

以上代码模拟定时任务。 该异步进程一旦启动则常驻，不会每隔10秒启动一个异步进程，而是在同一个进程里面，不停的接受投递过来的参数。

依赖
--

[](#依赖)

本库依赖redis实现进程管理,需安装redis扩展，并提供账号和密码。

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3248d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f1c54583ef1558c61d88bf794067bbefa7a1ee3ef3a4db8851e3202b964760a?d=identicon)[sanderswang](/maintainers/sanderswang)

---

Top Contributors

[![muyizixiu](https://avatars.githubusercontent.com/u/10430401?v=4)](https://github.com/muyizixiu "muyizixiu (2 commits)")

### Embed Badge

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

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

PHPackages © 2026

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