data-dog / php-nsq
PHP 的 NSQ 发布者
0.2.3
2014-09-01 12:05 UTC
Requires
- php: >=5.3.0
- ext-sockets: *
Requires (Dev)
- phpspec/phpspec: ~2.0
This package is not auto-updated.
Last update: 2024-09-10 03:24:17 UTC
README
这个库仅用于向 NSQ 节点发布消息。需要标准的 PHP socket 扩展。
安装
添加到 composer.json
{ "require": { "data-dog/php-nsq": "~0.2.0" } }
使用示例
<?php include __DIR__ . '/vendor/autoload.php'; use Nsq\NsqPool; use Nsq\Socket\PhpSocket; use Nsq\Message\JsonMessage; $nsq = new NsqPool( new PhpSocket('127.0.0.1', 4150), new PhpSocket('127.0.0.1', 4170) ); $nsq->publish('my_topic', new JsonMessage(['message' => 'data']));
运行测试
composer install
./bin/phpspec run