Go to file
2012-07-07 19:34:54 +09:00
examples refactor tcp_bind 2012-07-07 19:23:22 +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 fix uv_tcp_bind6 2012-07-07 00:20:22 +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 re-setup irc notification 2012-07-07 13:32:21 +09:00
config.m4 add http parser support: 2012-07-01 13:15:14 +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 align indents 2012-07-07 19:34:54 +09:00
php_uv.h bump down uv ext version. php-uv is very experimental 2012-07-01 22:36:40 +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 readme [ci skip] 2012-07-02 00:51:08 +09:00
uv.c add http parser support: 2012-07-01 13:15:14 +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