Giter Club home page Giter Club logo

assistant's Introduction

Assistant

Build Status Code Quality Code Coverage Version License

A neat wrapper around multi-process abstractions and distributed event emitters.

Usage

use AsyncPHP\Assistant\Proxy\DoormanProxy;
use AsyncPHP\Doorman\Manager\ProcessManager;
use AsyncPHP\Remit\Location\InMemoryLocation;

$proxy = new DoormanProxy(
    new ProcessManager(),
    new ZeroMqServer(
        new InMemoryLocation("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.

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.

assistant's People

Contributors

assertchris avatar

Stargazers

Kevyworks avatar Gennaro Landolfi avatar Jo avatar Tom Sisk avatar Jonathan Rehm avatar Bas Kamer avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.