Go to file
2012-07-11 22:24:05 +09:00
examples - use fci and fcc instead of zval. 2012-07-11 13:07:08 +09:00
http-parser@9852e5d048 add http parser support: 2012-07-01 13:15:14 +09:00
libuv@171e2f71b9 use libuv v0.8.0. for now this can compile osx only. i'll fix it soon 2012-06-23 12:07:22 +09:00
tests add fs_poll_start/stop functions 2012-07-09 01:27:02 +09:00
.gitignore update gitignore 2012-06-24 22:35:07 +09:00
.gitmodules add http parser support: 2012-07-01 13:15:14 +09:00
.travis.yml missing notification parameter 2012-07-07 23:16:15 +09:00
config.m4 add ./configure --enable-uv-debug option. 2012-07-09 13:57:16 +09:00
config.w32 update config.w32: http-parser support 2012-07-01 13:47:26 +09:00
EXPERIMENTAL add experimental 2012-06-02 21:46:33 +09:00
php_uv.c use fci and fcc for prepare_cb 2012-07-11 22:24:05 +09:00
php_uv.h use fci and fcc for prepare_cb 2012-07-11 22:24:05 +09:00
phpunit.xml.dist isolate process for php tests 2012-06-25 10:45:20 +02:00
README.md update readme [ci skip] 2012-07-02 00:51:08 +09:00
TODO.md update todo [ci skip] 2012-07-09 14:33:37 +09:00
uv.c add poll api 2012-07-09 12:24:35 +09:00

php-uv

Build Status

interface to libuv for php (experimental). also supports http-parser.

Experimental

This extension is experimental, its functions may change their names or move to extension all together so do not rely to much on them you have been warned!

Install

git clone https://github.com/chobie/php-uv.git --recursive
cd php-uv
(cd libuv && make)
phpize
./configure
make
make install
# add `extension=uv.so` to your php.ini

Examples

see examples and tests directory.

<?php
$tcp = uv_tcp_init();

uv_tcp_bind($tcp, uv_ip4_addr('0.0.0.0',8888));

uv_listen($tcp,100, function($server){
    $client = uv_tcp_init();
    uv_accept($server, $client);
    var_dump(uv_tcp_getsockname($server));

    uv_read_start($client, function($socket, $nread, $buffer){
        var_dump($buffer);
        uv_close($socket);
    });
});

$c = uv_tcp_init();
uv_tcp_connect($c, uv_ip4_addr('0.0.0.0',8888), function($stream, $stat){
    if ($stat == 0) {
        uv_write($stream,"Hello",function($stream, $stat){
            uv_close($stream);
        });
    }
});

uv_run();

Community

Check out #php-uv on irc.freenode.net.

Author

  • Shuhei Tanuma

License

PHP License