clue/socket-react
Composer 安装命令:
composer require clue/socket-react
包简介
Binding for raw sockets (ext-sockets) in reactphp
README 文档
README
Binding for raw sockets (ext-sockets) in React PHP.
Quickstart example
Once installed, you can use the following example to send UDP broadcast datagrams:
$loop = React\EventLoop\Factory::create(); $factory = new Socket\React\Datagram\Factory($loop); $promise = $factory->createClient('udp://localhost:1337', array('broadcast' => true)); $promise->then(function (Socket\React\Datagram\Socket $socket) { $socket->send('test'); $socket->on('message', function($data, $peer) { var_dump('Received', $data, 'from', $peer); }); }); $loop->run();
See also the examples.
Install
The recommended way to install this library is through composer. New to composer?
{
"require": {
"clue/socket-react": "~0.3.0"
}
}
Tests
To run the test suite, you need PHPUnit. Go to the project root and run:
$ phpunit tests
Note: The test suite contains tests for ICMP sockets which require root access on unix/linux systems. Therefor some tests will be skipped unless you run
sudo phpunit teststo execte the full test suite.
License
MIT
统计信息
- 总下载量: 1.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-04-17