PHPackages                             easyswoole/sync-invoker - 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. [Framework](/categories/framework)
4. /
5. easyswoole/sync-invoker

ActiveLibrary[Framework](/categories/framework)

easyswoole/sync-invoker
=======================

An efficient swoole framework

2.1.0(3y ago)07.8k↓20%1Apache-2.0PHPPHP &gt;=8.0

Since Jun 21Pushed 3y agoCompare

[ Source](https://github.com/easy-swoole/sync-invoker)[ Packagist](https://packagist.org/packages/easyswoole/sync-invoker)[ Docs](https://www.easyswoole.com/)[ RSS](/packages/easyswoole-sync-invoker/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (16)Used By (0)

Sync Invoker
============

[](#sync-invoker)

场景
--

[](#场景)

Swoole4.x后，提供了非常强大的协程能力，让我们可以更好的压榨服务器性能，提高并发。然而，目前PHP在swoole协程生态上，并不是很完善，比如没有协程版本的monogodb客户端，而为了避免在worker中调用了同步阻塞的Api，例如在Http回调中使用了同步的芒果客户端，导致worker退化为同步阻塞，导致没办法完全的发挥协程的优势， EasySwoole 提供了一个同步程序协程调用转化驱动。

原理
--

[](#原理)

启动自定义进程监听UnixSocket，然后worker端调用协程客户端发送命令到自定义进程并处理，然后把处理结果返回给worker的协程客户端。

示例代码
----

[](#示例代码)

```
use EasySwoole\SyncInvoker\AbstractDriver;
use EasySwoole\SyncInvoker\SyncInvoker;
use EasySwoole\SyncInvoker\Worker;
require 'vendor/autoload.php';

class Driver extends AbstractDriver
{
    function plus($a,$b)
    {
        $this->response($a + $b);
    }

    protected function actionNotFound()
    {
        $this->response($this->getRequest()->getAction().' not found');
    }

}

$invoker = new SyncInvoker();
$invoker->getConfig()->setDriver(new Driver());
$invoker->getConfig()->setOnWorkerStart(function (Worker $worker){
    var_dump('worker start at Id '.$worker->getArg()['workerIndex']);
});

$http = new swoole_http_server("0.0.0.0", 9501);

$invoker->attachServer($http);

$http->on("request", function ($request, $response)use($invoker) {
    $ret = $invoker->invoke()->plus(1,2);
    var_dump($ret);

    $ret = $invoker->invoke()->plus2(1,2);
    var_dump($ret);
});

$http->start();
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity72

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

Every ~92 days

Recently: every ~185 days

Total

15

Last Release

1225d ago

Major Versions

1.0.6 → 2.0.02020-12-21

PHP version history (2 changes)1.0.0PHP &gt;=7.1.0

2.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/45c234d5f129ea570e630425636299127647534f0c2cbb073555e2c45d403d6f?d=identicon)[kiss291323003](/maintainers/kiss291323003)

---

Top Contributors

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

---

Tags

asyncframeworkswooleeasyswoole

### Embed Badge

![Health badge](/badges/easyswoole-sync-invoker/health.svg)

```
[![Health](https://phpackages.com/badges/easyswoole-sync-invoker/health.svg)](https://phpackages.com/packages/easyswoole-sync-invoker)
```

###  Alternatives

[easyswoole/easyswoole

An efficient swoole framework

4.8k186.9k50](/packages/easyswoole-easyswoole)[easyswoole/orm

php stander lib

3088.7k17](/packages/easyswoole-orm)[easyswoole/kafka

An efficient swoole framework

4211.1k](/packages/easyswoole-kafka)[easyswoole/fast-cache

An efficient swoole framework

1030.3k2](/packages/easyswoole-fast-cache)[easyswoole/actor

easyswoole component

1410.3k](/packages/easyswoole-actor)[easyswoole/words-match

An efficient swoole framework

171.6k3](/packages/easyswoole-words-match)

PHPackages © 2026

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