nc/elephantio-bundle

Symfony2 中 Elephant IO 集成

v2.1.0 2016-10-14 01:13 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:36:29 UTC


README

Build Status

knpbundles.com

Sensio insight

Elephant.io 库在 symfony2 中的集成。

此包允许您从 Symfony2 应用程序与 socket.io 服务器(0.x 或 1.x)进行通信。

安装

composer require nc/elephantio-bundle

在您的 AppKernel 中

public function registerbundles()
{
    return [
    	...
    	...
    	new Nc\Bundle\ElephantIOBundle\NcElephantIOBundle(),
    ];
}

配置示例

nc_elephant_io:
    clients:
        default:
            connection: http://192.168.0.14:3006
            # specify version 0.x for 0.* version and 1.x for 1.0 version
            version: 0.x
        your_key:
            connection: http://192.168.0.14:3000
            version: 1.x

使用方法

$client = $this->get('elephantio_client.your_key');
$client->send('event_name', ['foo' => 'test']);

更复杂的使用

$client = $this->get('elephantio_client.your_key');
$elephantIOClient = $client->getElephantIO();
// Refer to Elephant.io doc

贡献?

如果您想改进这个包,可以使用 github pull-request 和 issue。