Go to file
2012-07-09 00:18:26 +09:00
examples WIP: uv_queue_work 2012-07-07 22:57:42 +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 udp_send6 function 2012-07-08 23:24:31 +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 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 add uv_sem_init 2012-07-09 00:18:26 +09:00
php_uv.h add uv_sem_init 2012-07-09 00:18:26 +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