2017 © Pedro Peláez
 

library streaming

Redis Async Streaming for PHP

image

laravie/streaming

Redis Async Streaming for PHP

  • Tuesday, July 10, 2018
  • by crynobone
  • Repository
  • 2 Watchers
  • 7 Stars
  • 2,869 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 13 % Grown

The README.md

Redis Async Streaming for PHP

The project allows you as a developer to listen to Redis pubsub using async instead of blocking I/O using PHP. This is done by utilizing predis/predis-async under the hood., (*1)

tests Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status, (*2)

Installation

To install through composer, simply put the following in your composer.json file:, (*3)

{
    "require": {
        "laravie/streaming": "^3.0"
    }
}

And then run composer install from the terminal., (*4)

Quick Installation

Above installation can also be simplify by using the following command:, (*5)

composer require "laravie/streaming=^3.0"

Example

<?php

$eventLoop = React\EventLoop\Factory::create();

$chat = new class implements Laravie\Streaming\Listener {
    /**
     * @return array<int, string>
     */
    public function subscribedChannels(): array {
        return ['topic:*'];
    }

    /**
     * @param  \Predis\Async\Client  $redis  
     * @return void
     */
    public function onConnected($redis) {
        echo "Connected to redis!";
    }

    /**
     * @param  \Predis\Async\Client  $redis  
     * @return void
     */
    public function onSubscribed($redis) {
        echo "Subscribed to channel `topic:*`!";
    }

    /**
     * Trigger on emitted listener.
     *
     * @param  object  $event
     * @param  object  $pubsub
     *
     * @return void
     */
    public function onEmitted($event, $pubsub) {
        // PUBLISH topic:laravel "Hello world"

        # DESCRIBE $event
        #
        # {
        #   "kind": "pmessage",
        #   "pattern": "topic:*",
        #   "channel": "topic:laravel",
        #   "payload": "Hello world"
        # }
    }
}

$client = new Laravie\Streaming\Client(
    ['host' => '127.0.0.1', 'port' => 6379], $eventLoop
);

$client->connect($chat);

$eventLoop->run();

The Versions

10/07 2018

dev-master

9999999-dev

Redis Async Streaming for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

10/07 2018

v2.1.0

2.1.0.0

Redis Async Streaming for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

10/02 2018

v2.0.0

2.0.0.0

Redis Async Streaming for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

13/11 2017

v1.1.0

1.1.0.0

Redis Async Streaming for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

12/07 2017

v1.0.1

1.0.1.0

Redis Async Streaming for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

03/07 2017

v1.0.0

1.0.0.0

Redis Async Streaming for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires