asyncphp/remit

3.1.2 2015-12-06 21:28 UTC

This package is auto-updated.

Last update: 2024-12-19 02:25:40 UTC


README

Build Status Code Quality Code Coverage Version License

Distributed event emitter. Compatible from PHP 5.3 to PHP 7.

Usage

Listening for events:

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"));

You can find more in-depth documentation in docs/en.

Motivation

This library provides a small, simple API for allowing bi-directional communication between processes, and across multiple servers. It's an event emitter, where the listeners can be in a different process, or on a different server to the code that emits events to them.

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Thanks

I'd like to thank SilverStripe for letting me work on fun projects like this. Feel free to talk to me about using the framework and CMS or working at SilverStripe.