PHPackages                             kaixings/proutine - 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. kaixings/proutine

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

kaixings/proutine
=================

php rustic coroutine

v0.0.1(2y ago)15MITPHPPHP ^5.5|^7.0|^8.0

Since Jul 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kaixings/proutine)[ Packagist](https://packagist.org/packages/kaixings/proutine)[ Docs](https://github.com/kaixings/proutine)[ RSS](/packages/kaixings-proutine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

proutine
========

[](#proutine)

php rustic coroutine

### 介绍

[](#介绍)

使用PHP yield 来模拟类似go、swoole的简易协程

参照鸟哥 [在PHP中使用协程实现多任务调度](https://www.laruence.com/2015/05/28/3038.html) 文章相关的代码。

利用yield生成器去遍历非阻塞io（mysqli的异步模式、curl\_multi的非阻塞情况）的“句柄”，来达到同时进行的并发效果；

### 安装

[](#安装)

```
composer require kaixings/proutine
```

### 例子

[](#例子)

```
use Kaixings\Proutine\CurlMulti;
use Kaixings\Proutine\Mysql;
use Kaixings\Proutine\Scheduler;

$start = microtime(true);

$curlM = new CurlMulti();
//example your own domain1
$curlGen = $curlM->curl(['url'=>'http://domain1.com']);

//example your own domain2
$curlGen2 = $curlM->curl(['url'=>'http://domain2.com']);

$mysql = new Mysql([
    'host' => 'host',
    'username'=>'root',
    'database' => 'database',
    'password' => 'password',
    'port' =>3306,
]);

$mysqlGen = $mysql->queryGen("select sleep(1);");

$scheduler = new Scheduler();
$scheduler->newTask($curlGen);
$scheduler->newTask($curlGen2);
$scheduler->newTask($mysqlGen);
$scheduler->run();
```

### 许可证

[](#许可证)

proutine是根据MIT许可证发布的. 有关更多信息，请参见 [LICENSE](LICENSE) 文件.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

1023d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e58bb6c5278b9cefaa656af1e5f12519077704125d5ef35cec7aa1166e7fb8e?d=identicon)[kaixings](/maintainers/kaixings)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/kaixings-proutine/health.svg)

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

PHPackages © 2026

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