PHPackages                             easyswoole/actor - 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/actor

ActiveLibrary[Framework](/categories/framework)

easyswoole/actor
================

easyswoole component

2.0.7(2y ago)1410.3k↓100%8[1 PRs](https://github.com/easy-swoole/actor/pulls)Apache-2.0PHPPHP &gt;=7.1.0

Since Dec 27Pushed 2y agoCompare

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

READMEChangelog (10)Dependencies (5)Versions (39)Used By (0)

Actor
=====

[](#actor)

提供Actor模式支持，助力游戏行业开发。EasySwoole的Actor采用自定义process作为存储载体，以协程作为最小调度单位，利用协程Channel做mail box,而客户端与process之间的通讯，采用UnixSocket实现。

测试代码
----

[](#测试代码)

### 服务端-SwooleServer模式

[](#服务端-swooleserver模式)

```

```

### 服务端-Process模式

[](#服务端-process模式)

```
use EasySwoole\Actor\Actor;
use EasySwoole\Actor\Actor;
use EasySwoole\Actor\Test\RoomActor;
use EasySwoole\Actor\ProxyProcess;

Actor::getInstance()->register(RoomActor::class);
$list = Actor::getInstance()->generateProcess();

foreach ($list['proxy'] as  $proxy){
    /** @var ProxyProcess $proxy */
    $proxy->getProcess()->start();
}

foreach ($list['worker'] as $actors){
    foreach ($actors as $actorProcess){
        /** @var ProxyProcess $actorProcess */
        $actorProcess->getProcess()->start();
    }
}

while($ret = \Swoole\Process::wait()) {
    echo "PID={$ret['pid']}\n";
}

```

### 客户端-cli单元测试

[](#客户端-cli单元测试)

```
use EasySwoole\Actor\Actor;
use EasySwoole\Actor\Test\RoomActor;
Actor::getInstance()->register(RoomActor::class);

go(function (){
    $actorId = RoomActor::client()->create('create arg1');
    var_dump($actorId);
    \co::sleep(3);
    var_dump(RoomActor::client()->send($actorId,'this is msg'));
    \co::sleep(3);
    var_dump(RoomActor::client()->exit($actorId,'this is exit arg'));

    \co::sleep(3);
    RoomActor::client()->create('create arg2');
    \co::sleep(3);
    RoomActor::client()->create('create arg3');
    \co::sleep(3);
    var_dump(RoomActor::client()->sendAll('sendAll msg'));
    \co::sleep(3);
    var_dump(RoomActor::client()->status());
    \co::sleep(3);
    var_dump(RoomActor::client()->exitAll('sendAll exit'));

});

```

> 注意请基于协程实现，不要在actor中写阻塞代码，否则效率会非常差。其次使用虚拟机,docker等方式开发,不能在共享文件夹使用，因为unixsock 无法在共享目录中正确读写，请修改tempDir临时目录，把unxisock文件挂载在非共享目录即可.

内存问题
----

[](#内存问题)

Actor数据分散在进程内，一个进程可能需要占用很大的内存，因此请根据实际业务量配置内存大小。

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~48 days

Recently: every ~369 days

Total

38

Last Release

907d ago

Major Versions

1.1.16 → 2.0.12019-06-05

2.0.6 → 3.x-dev2021-08-06

### 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 (76 commits)")[![evalor](https://avatars.githubusercontent.com/u/26944445?v=4)](https://github.com/evalor "evalor (3 commits)")[![tioncico](https://avatars.githubusercontent.com/u/31308307?v=4)](https://github.com/tioncico "tioncico (1 commits)")[![xiaocaigua](https://avatars.githubusercontent.com/u/11884276?v=4)](https://github.com/xiaocaigua "xiaocaigua (1 commits)")

---

Tags

asyncframeworkswooleeasyswoole

### Embed Badge

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

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

###  Alternatives

[easyswoole/easyswoole

An efficient swoole framework

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

An efficient swoole framework

7731.6k2](/packages/easyswoole-rpc)[easyswoole/kafka

An efficient swoole framework

4211.1k](/packages/easyswoole-kafka)[easyswoole/orm

php stander lib

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

easyswoole component

691.1k](/packages/easyswoole-compiler)[easyswoole/fast-cache

An efficient swoole framework

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

PHPackages © 2026

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