asyncphp / remit
3.1.2
2015-12-06 21:28 UTC
Requires
- php: >=5.5.9
Requires (Dev)
- phpunit/phpunit: ^4.7
README
分布式事件发射器。兼容从PHP 5.3
到PHP 7
。
用法
监听事件
use AsyncPHP\Remit\Client\ZeroMqClient; use AsyncPHP\Remit\Client\ZeroMqServer; use AsyncPHP\Remit\Location\InMemoryLocation; $server = new ZeroMqServer(new InMemoryLocation("127.0.0.1", 5555)); $server->addListener("my-event", function($param1, $param2) { // ...do a thing }); $client = new ZeroMqClient(new InMemoryLocation("127.0.0.1", 5555)); $this->client->emit("my-event", array("foo", "bar"));
您可以在 docs/en 中找到更详细的文档。
动机
这个库提供了一个小型、简单的API,允许进程间以及多个服务器之间的双向通信。它是一个事件发射器,其中监听器可以位于不同的进程或不同的服务器上,而代码则向它们发射事件。
版本控制
此库遵循 Semver。根据Semver,您将能够升级到此库的任何次要或补丁版本,而无需对公共API进行任何破坏性更改。Semver还要求我们明确定义此库的公共API。
所有具有 public
可见性的方法都是公共API的一部分。所有其他方法都不是公共API的一部分。在可能的情况下,我们将尝试在次要/补丁版本中保持 protected
方法的向后兼容性,但如果您正在重写方法,请在升级之前测试您的代码。
感谢
我想感谢 SilverStripe 允许我从事这样的有趣项目。请随时与我讨论使用 框架和CMS 或 在SilverStripe工作。