You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A neat wrapper around multi-process abstractions and distributed event emitters.
Usage
useAsyncPHP\Assistant\Proxy\DoormanProxy;
useAsyncPHP\Doorman\Manager\ProcessManager;
useAsyncPHP\Remit\Location\InMemoryLocation;
$proxy = newDoormanProxy(
newProcessManager(),
newZeroMqServer(
newInMemoryLocation("127.0.0.1", 5555)
)
);
$proxy
->parallel(function() {
// do this task in a separate process
})
->synchronous(function() {
// ...then do this task in the parent process
})
->parallel([
function() {
// ...then do this task in a separate process$this->emit("custom event", ["hello world"]);
},
function() {
// ...and do this at the same time, in a separate process
},
]);
$proxy->addListener("custom event", function($message) {
print"custom event emitted with: {$message}";
});
while ($proxy->tick()) {
usleep(25000);
}
You can find more in-depth documentation in docs/en.
Motivation
Doorman and Remit at great, but they can be tricky to learn and verbose at times. This aims to simplify that.
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.