Light, concurrent RPC framework for PHP & C

Overview

Yar - Yet Another RPC framework for PHP

Build Status Build status Build Status

Light, concurrent RPC framework for PHP(see also: Yar C framework, Yar Java framework)

Requirement

  • PHP 7.0+ (master branch))
  • PHP 5.2+ (php5 branch)
  • Curl
  • Json
  • Msgpack (Optional)

Introduction

Yar is a RPC framework which aims to provide a simple and easy way to do communication between PHP applications

It has the ability to concurrently call multiple remote services.

Features

  • Fast, Easy, Simple
  • Concurrent RPC calls
  • Multiple data packager supported (php, json, msgpack built-in)
  • Multiple transfer protocols supported (http, https, TCP)
  • Detailed debug informations

Install

Install Yar

Yar is an PECL extension, thus you can simply install it by:

pecl install yar

Compile Yar in Linux

$/path/to/phpize
$./configure --with-php-config=/path/to/php-config/
$make && make install

Available instructions to configure are

--with-curl=DIR
--enable(disable)-msgpack
--enable(disable)-epoll (require Yar 2.1.2)

Install Yar with msgpack

first you should install msgpack-ext

pecl install msgpack

or for ubuntu user

apt-get install msgpack-php

or , you can get the github source here: https://github.com/msgpack/msgpack-php

then:

$phpize
$configure --with-php-config=/path/to/php-config/ --enable-msgpack
$make && make install

Runtime Configure

  • yar.timeout //default 5000 (ms)
  • yar.connect_timeout //default 1000 (ms)
  • yar.packager //default "php", when built with --enable-msgpack then default "msgpack", it should be one of "php", "json", "msgpack"
  • yar.debug //default Off
  • yar.expose_info // default On, whether output the API info for GET requests
  • yar.content_type // default "application/octet-stream"
  • yar.allow_persistent // default Off

NOTE yar.connect_time is a value in milliseconds, and was measured in seconds in 1.2.1 and before.

Constants

  • YAR_VERSION
  • YAR_OPT_PACKAGER
  • YAR_OPT_PERSISTENT
  • YAR_OPT_TIMEOUT
  • YAR_OPT_CONNECT_TIMEOUT
  • YAR_OPT_HEADER // Since 2.0.4
  • YAR_OPT_PROXY //Since 2.2.0

Server

It's very easy to setup a Yar HTTP RPC Server

<?php
class API {
    /**
     * the doc info will be generated automatically into service info page.
     * @params 
     * @return
     */
    public function some_method($parameter, $option = "foo") {
    }

    protected function client_can_not_see() {
    }
}

$service = new Yar_Server(new API());
$service->handle();
?>

Usual RPC calls will be issued as HTTP POST requests. If a HTTP GET request is issued to the uri, the service information (commented section above) will be printed on the page:

yar service info page

Client

It's very simple for a PHP client to call remote RPC:

Synchronous call

<?php
$client = new Yar_Client("http://host/api/");
/* the following setopt is optinal */
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);

$client->SetOpt(YAR_OPT_HEADER, array("hd1: val", "hd2: val"));  //Custom headers, Since 2.0.4

/* call remote service */
$result = $client->some_method("parameter");
?>

Concurrent call

<?php
function callback($retval, $callinfo) {
     var_dump($retval);
}

function error_callback($type, $error, $callinfo) {
    error_log($error);
}

Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"));   // if the callback is not specificed, 
                                                                               // callback in loop will be used
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", "error_callback", array(YAR_OPT_PACKAGER => "json"));
                                                                               //this server accept json packager
Yar_Concurrent_Client::call("http://host/api/", "some_method", array("parameters"), "callback", "error_callback", array(YAR_OPT_TIMEOUT=>1));
                                                                               //custom timeout 
 
Yar_Concurrent_Client::loop("callback", "error_callback"); //send the requests, 
                                                           //the error_callback is optional
?>

Persistent call

After Yar 2.1.0, if YAR_OPT_PERSISTENT is set to true, then Yar is able to use HTTP keep-alive to speedup repeated calls to a same address, the link will be released at the end of the PHP request lifecycle.

<?php
$client = new Yar_Client("http://host/api/");
$client->SetOpt(YAR_OPT_PERSISTENT, 1);

$result = $client->some_method("parameter");

/* The following calls will speed up due to keep-alive */
$result = $client->some_other_method1("parameter");
$result = $client->some_other_method2("parameter");
$result = $client->some_other_method3("parameter");
?>

Custom hostname resolving

After Yar 2.1.0, if Yar runs on HTTP protocol, YAR_OPT_RESOLVE could be used to define custom hostname resolving.

<?php
$client = new Yar_Client("http://host/api/");

$client->SetOpt(YAR_OPT_RESOLVE, array("host:80:127.0.0.1"));

/* call goes to 127.0.0.1 */
$result = $client->some_method("parameter");

Use http proxy

After Yar 2.2.1, if Yar runs on HTTP protocol, YAR_OPT_PROXY could be used to define http proxy , such as fidder or charles.

<?php
$client = new Yar_Client("http://host/api/");

$client->SetOpt(YAR_OPT_PROXY,"127.0.0.1:8888"); //http proxy , Since 2.2.0

/* call goes to 127.0.0.1 */
$result = $client->some_method("parameter"); 

Protocols

Yar Header

Since Yar will support multi transfer protocols, so there is a Header struct, I call it Yar Header

#ifdef PHP_WIN32
#pragma pack(push)
#pragma pack(1)
#endif
typedef struct _yar_header {
    uint32_t       id;            // transaction id
    uint16_t       version;       // protocol version
    uint32_t       magic_num;     // default is: 0x80DFEC60
    uint32_t       reserved;
    unsigned char  provider[32];  // reqeust from who
    unsigned char  token[32];     // request token, used for authentication
    uint32_t       body_len;      // request body len
}
#ifndef PHP_WIN32
__attribute__ ((packed))
#endif
yar_header_t;
#ifdef PHP_WIN32
#pragma pack(pop)
#endif

Packager Header

Since Yar also supports multi packager protocol, so there is a char[8] at the begining of body, to identicate which packager the body is packaged by.

Request

When a Client request a remote server, it will send a struct (in PHP):

<?php
array(
   "i" => '', //transaction id
   "m" => '', //the method which being called
   "p" => array(), //parameters
)

Server

When a server response a result, it will send a struct (in PHP):

<?php
array(
   "i" => '',
   "s" => '', //status
   "r" => '', //return value 
   "o" => '', //output 
   "e" => '', //error or exception
)
Comments
  • windows 平台 报错 Yar_Client_Transport_Exception' with message 'curl exec failed 'Timeout was reached'

    windows 平台 报错 Yar_Client_Transport_Exception' with message 'curl exec failed 'Timeout was reached'

    BUG现象同:https://github.com/laruence/yar/issues/15 环境: windows7 php5.6.10/5.6.11 (nts x86) nginx 1.9.2 cURL Information 7.42.1 msgpack 0.5.6 yar 1.2.3/1.2.4

    错误为: Yar_Client_Transport_Exception’ with message ‘curl exec failed ‘Timeout was reached’

    配置了php.ini中yar.debug=1,可以看到: Warning: [Debug Yar_Client 18:39:21.422666]: 575645727: call api ‘api’ at (r)’http://zftest/yar/service/TestServiceProvider.php‘ with ’1′ parameters in E:\workspace\test_project\unit_test\src\main\yar\client\TestConsumer.php on line 31

    Warning: [Debug Yar_Client 18:39:21.422666]: 575645727: pack request by ‘PHP’, result len ’80′, content: ‘a:3:{s:1:”i”;i:575645727;s:1:”m”‘ in E:\workspace\test_project\unit_test\src\main\yar\client\TestConsumer.php on line 31

    跟了一下nginx的access日志: POST /yar/service/TestServiceProvider.php HTTP/1.1 499 0 4.992 第一部分,post请求, 第二部分:请求地址与协议, 第三部分:返回的http状态码 第四部分:消息体长度 第五部分:请求时长

    opened by agclqq 14
  • yar windows 不支持yar_concurrent_client::loop();

    yar windows 不支持yar_concurrent_client::loop();

    鸟哥你好,我在windows下用了yar.dll,是在pecl下载的。 PHP5.4,curl7.29 但是也是一直报这个错误。

    [23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.271401]: 440193860: call api 'add' at (r)'http://test.me/server.php' with '2' parameters in D:\httproot\test\client.php on line 13

    [23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.274330]: 440193860: pack request by 'PHP', result len '82', content: 'a:3:{s:1:"i";i:440193860;s:1:"m"' in D:\httproot\test\client.php on line 13

    [23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.277817]: -1015573128: call api 'mul' at (r)'http://test.me/server.php' with '2' parameters in D:\httproot\test\client.php on line 13

    [23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.280518]: -1015573128: pack request by 'PHP', result len '84', content: 'a:3:{s:1:"i";i:-1015573128;s:1:"' in D:\httproot\test\client.php on line 13

    [23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: Yar_Concurrent_Client::loop(): can not get fd from curl instance in D:\httproot\test\client.php on line 13

    但是用$client->add();这种一个个来的就没问题了,但百度下这个问题,貌似没有结果 官网也没看到有关windows下的介绍。所以麻烦鸟哥了,谢谢。

    opened by regittiger 12
  • yar socket调用会core

    yar socket调用会core

    Hello 鸟哥:

    yar用socket方式调用一个tcp服务偶尔时会出现core,coredump信息如下: #0 _zend_mm_free_int () at /tmp/php-5.6.10/Zend/zend_alloc.c:2104 #1 0x00007f8a4ae411a6 in php_yar_client_handle (ht=, return_value=0x33d0218, return_value_ptr=, this_ptr=,

    return_value_used=<value optimized out>) at /home/wxx/yar-yar-1.2.5/yar_client.c:271
    

    #2 zim_yar_client___call (ht=, return_value=0x33d0218, return_value_ptr=, this_ptr=, return_value_used=)

    at /home/wxx/yar-yar-1.2.5/yar_client.c:546
    

    #3 0x00000000007e7e46 in zend_call_function () #4 0x000000000080e025 in zend_call_method () #5 0x000000000081d12c in zend_std_call_user_call () at /tmp/php-5.6.10/Zend/zend_object_handlers.c:931 #6 0x000000000089c29e in zend_do_fcall_common_helper_SPEC () at /tmp/php-5.6.10/Zend/zend_vm_execute.h:558 #7 0x000000000082c8e8 in execute_ex () at /tmp/php-5.6.10/Zend/zend_vm_execute.h:363 #8 0x00000000007f88d0 in zend_execute_scripts () #9 0x0000000000796fa2 in php_execute_script () #10 0x00000000008a72d1 in main () at /tmp/php-5.6.10/sapi/fpm/fpm/fpm_main.c:1964

    opened by zhanglei 11
  • php7.1 环境下的 同时使用YAF  和YAR 结果报错了  内存耗尽

    php7.1 环境下的 同时使用YAF 和YAR 结果报错了 内存耗尽

    class IndexController extends Yaf_Controller_Abstract {

    /** 
    * 构造函数
    * 
    * @param  $type 整型 类型(1: 类型a 2:类型b 3:类型c 4:类型d 5:类型e)
    * 	
    * @return $rows 数组 返回对应的数据包
    */
    Public function indexAction(){	
    	$server = new Yar_Server($this);
    	$server->handle();
    }
    

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1936288885 bytes) in /www/wwwroot/

    按说明书的方法写没问题 , 我这样用是 YAF的问题 还是YAR的问题 ?

    代码不变切换成5.6的就是OK的 , 没有任何的报错的

    question 
    opened by archoncap 7
  • yar 并行调用 不支持设置 timeout

    yar 并行调用 不支持设置 timeout

    Yar_Concurrent_Client::call("http://rpcapi******", "getrelkey", array('生产毛坯', 'com'), 'callback', 'error_callback', array(YAR_OPT_TIMEOUT=>1)); Yar_Concurrent_Client::loop(); //send

    getrelkey 函数中sleep 4s

    发现设置的YAR_OPT_TIMEOUT 1s没起作用

    $client = new Yar_Client("http://rpcapi**************"); $client->SetOpt(YAR_OPT_TIMEOUT, 1); $result = $client->getrelkey(array('生产毛坯', 'com')); var_dump($result);

    这样设置的1s能看到效果

    另外php.ini里面设置1000也能看到效果

    系统max os PHP Version 5.3.28 curl cURL support enabled

    cURL Information 7.33.0

    yar yar support enabled Version 1.2.4-dev

    Directive Local Value Master Value yar.allow_persistent 0 0 yar.connect_timeout 1000 1000 yar.content_type application/octet-stream application/octet-stream yar.debug 0 0 yar.expose_info On On yar.packager php php yar.timeout 5000 5000 yar.transport curl curl

    盼回复

    opened by jianhuihi 7
  • Yar在OS X上执行失败,但是Linux上执行正常[已解决,是php开启--with-debug编译参数的问题]

    Yar在OS X上执行失败,但是Linux上执行正常[已解决,是php开启--with-debug编译参数的问题]

    在Mac上客户端报的错误是:

    server responsed non-200 code '500'
    

    error_log中的服务器端的错误是

    PHP Fatal error:  Yar_Server::handle():  in /Users/mac/work/yarTest/server.php on line 16
    

    用的代码就是官网提供的例子,如下:

    <?php
    
    ini_set("display_errors", "Off");
    
    class API {
        /**
         * the doc info will be generated automatically into service info page.
         * @params
         * @return
         */
        public function doApi($parameter='', $option = "foo") {
            return $parameter;
        }
    
        /**
         * generated
         * @return
         */
        protected function client_can_not_see() {
        }
    }
    
    
    $service = new Yar_Server(new API());
    $service->handle();
    

    调用代码

    <?php
    $x = new Yar_Client('http://target_server/test.php');
    try {
        $param = 'hello';
        $ret = $x->doApi($param);
        var_dump($ret);
    } catch (Exception $e ) {
        echo $e->getMessage();
    }
    

    Mac上测试了1.2.3和1.2.4 Linux上面只测试了1.2.3 PHP是homebrew-php的php56

    opened by vimac 6
  • 我想吧yar融合入yaf中 可是报错

    我想吧yar融合入yaf中 可是报错

    鸟哥 你好 我想做一个rpc接口 用yaf+yar实现

    但是 我在控制器里写了一下代码

    class IndexController Extends Yaf_Controller_Abstract { private function init() { $service = new Yar_Server(new static()); $service->handle();

    }
    
    public function loginAction() {//默认Action
    }
    

    }

    但是返回错误信息如下 Warning: Yaf_Controller_Abstract::__construct() expects at least 3 parameters, 0 given in D:\wwwroot\FrameWork\yaf-yar\app\application\modules\User\controllers\Index.php on line 14 想问问鸟哥有什么好方法推荐没

    opened by iranw 6
  • yar总是报错。关闭错误日志就能返回值,但是日志中还是记录同样的错误

    yar总是报错。关闭错误日志就能返回值,但是日志中还是记录同样的错误

    鸟哥你好。我用yar的时候为什么总是报这个错呢,我的例子是复制手册的,第一次用这个。不是很懂,然后我关了display_errors,就能返回结果,但是错误日志里面的还是记录了那个错误。然后我看到之前有个人问道了差不多的问题,你说话个curl版本就行了?求解答,谢谢鸟哥~

    Warning: [Debug Yar_Client 5:52:34.649021]: 3928927588: call api 'add' at (r)'http://jessica.test/yar_server.php' with '2' parameters in /var/www/html/test/yar_client.php on line 6

    Warning: [Debug Yar_Client 5:52:34.649174]: 3928927588: pack request by 'PHP', result len '83', content: 'a:3:{s:1:"i";i:3928927588;s:1:"m' in /var/www/html/test/yar_client.php on line 6

    Fatal error: Uncaught exception 'Yar_Client_Protocol_Exception' with message 'malformed response header '
    Warning: [Debug Y'' in /var/www/html/test/yar_client.php:6 Stack trace: #0 /var/www/html/test/yar_client.php(6): Yar_Client->__call('add', Array) #1 /var/www/html/test/yar_client.php(6): Yar_Client->add(1, 2) #2 {main} thrown in /var/www/html/test/yar_client.php on line 6

    错误一直是这个。日志中记录的也是这个。不知道是不是和你之前解答一个人的那种情况一样。是curl的版本问题。

    这个是curl信息 cURL support enabled cURL Information 7.19.7 Age 3 Features AsynchDNS No Debug No GSS-Negotiate Yes IDN Yes IPv6 Yes Largefile Yes NTLM Yes SPNEGO No SSL Yes SSPI No krb4 No libz Yes CharConv No Protocols tftp, ftp, telnet, dict, ldap, ldaps, http, file, https, ftps, scp, sftp Host x86_64-redhat-linux-gnu SSL Version NSS/3.15.3 ZLib Version 1.2.3 libSSH Version libssh2/1.4.2 我是用yum安装的,不知道如何升级你说的那个版本。还有就是编译yar的时候提示要装libcurl和libcurl-devel,和那个有关系吗?谢谢鸟哥

    opened by regittiger 6
  • Fix test suite for Windows

    Fix test suite for Windows

    While loading the yar extension via the $cmd_args argument of yar_server_start() would work for running the tests via nmake test, that would require in-tree extension builds. At least for AppVeyor, the builds are done with phpsize for performance reasons, and as such we have to set TEST_PHP_ARGS anyway, which would then cause warnings regarding multiple loading of the extension. Therefore we do not use any default command line arguments.

    Furthermore, we must not connect stderr of the child processes to stderr of the parent, because that would yield spurious output, which breaks the test cases.

    Because eleven test cases are hanging on Windows for some yet unknown reason, and since dynamic XFAIL is only available as of PHP 7.4.0, we skip these tests for now.

    opened by cmb69 5
  • 支持在php.ini或代码中设置magic_num

    支持在php.ini或代码中设置magic_num

    说明: 由于这个功能修改较多,提交的目的是请鸟哥审阅。我们是Yar第一批的重度用户,希望有贡献。如果初衷与Yar本身不符,就不merge。

    初衷: 由于有跨公网的RPC需求,涉及到了安全性。所以考虑用magic_num去最简单地防止恶意请求(虽然这种方式仍然可能不是很稳固)。

    实现: 实现了在php.ini中采用yar.magic_num="0x80DFEC60"的形式设置magic_num; 实现了在php代码中采用$service->SetOpt(YAR_OPT_MAGIC_NUM, "0x80DFEC60");的形式设置magic_num(为了在同一个运行时下兼容各种Yar Server)。

    enhancement 
    opened by leeeboo 5
  • tests/047.phpt erratic results

    tests/047.phpt erratic results

    TEST 45/52 [tests/047.phpt]
    ========DIFF========
    001+ okayokayerrorerrorerror
    001- okayokayokayokayokay
    ========DONE========
    FAIL Check for yar server __auth (concurrent call) [tests/047.phpt] 
    
    

    could be related to old libcurl (encountered on RHEL 7 and 8 with libcurl 7.29 / 7.61) ?

    opened by remicollet 4
  • PHP 8.2

    PHP 8.2

    Notice Have to wait for https://github.com/php/php-src/pull/9576

    With this changes, still 1 test to fix

    =====================================================================
    PHP         : /opt/php82/bin/php 
    PHP_SAPI    : cli
    PHP_VERSION : 8.2.0-dev
    ZEND_VERSION: 4.2.0-dev
    PHP_OS      : Linux - Linux builder.remirepo.net 5.19.8-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 8 19:23:03 UTC 2022 x86_64
    INI actual  : /work/GIT/pecl-and-ext/yar/tmp-php.ini
    More .INIs  :  
    ---------------------------------------------------------------------
    PHP         : /opt/php82/bin/php-cgi 
    PHP_SAPI    : cgi-fcgi
    PHP_VERSION : 8.2.0-dev
    ZEND_VERSION: 4.2.0-dev
    PHP_OS      : Linux - Linux builder.remirepo.net 5.19.8-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 8 19:23:03 UTC 2022 x86_64
    INI actual  : /work/GIT/pecl-and-ext/yar/tmp-php.ini
    More .INIs  : 
    --------------------------------------------------------------------- 
    ---------------------------------------------------------------------
    PHP         : /opt/php82/bin/phpdbg 
    PHP_SAPI    : phpdbg
    PHP_VERSION : 8.2.0-dev
    ZEND_VERSION: 4.2.0-dev
    PHP_OS      : Linux - Linux builder.remirepo.net 5.19.8-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 8 19:23:03 UTC 2022 x86_64
    INI actual  : /work/GIT/pecl-and-ext/yar/tmp-php.ini
    More .INIs  : 
    ---------------------------------------------------------------------
    CWD         : /work/GIT/pecl-and-ext/yar
    Extra dirs  : 
    VALGRIND    : Not used
    =====================================================================
    TIME START 2022-09-19 11:14:39
    =====================================================================
    PASS Check for yar presence [tests/001.phpt] 
    PASS Check for yar server info [tests/002.phpt] 
    PASS Check for yar client [tests/003.phpt] 
    PASS Check for Yar_Client::setOpt [tests/004.phpt] 
    PASS Check for yar client with exception [tests/005.phpt] 
    PASS Check for yar concurrent client with exception [tests/006.phpt] 
    PASS Check for yar client with output by server [tests/007.phpt] 
    PASS Check for yar client with non yar server [tests/008.phpt] 
    PASS Check for yar client with 302 response [tests/009.phpt] 
    PASS Check for yar debug [tests/010.phpt] 
    PASS Check for yar server __auth [tests/011.phpt] 
    PASS Check for yar concurrent client with 128 calls [tests/012.phpt] 
    PASS Check for yar concurrent client with add call in callback [tests/013.phpt] 
    PASS Check for yar concurrent client with loop in callback [tests/014.phpt] 
    PASS Check for yar concurrent client with throw exception in callback [tests/015.phpt] 
    PASS Check for yar concurrent client with exit in callbacks [tests/016.phpt] 
    PASS Check for yar concurrent client with tcp rpc [tests/017.phpt] 
    PASS Check for yar server info (comment) [tests/018.phpt] 
    PASS Check for yar server info (internal function) [tests/019.phpt] 
    PASS Check for yar concurrent client with custom headers [tests/020.phpt] 
    PASS Check for YAR_OPT_PERSISTENT [tests/021.phpt] 
    PASS Check for YAR_OPT_RESOLVE [tests/022.phpt] 
    PASS Check for tcp protcol [tests/023.phpt] 
    PASS Check for setopt on tcp [tests/024.phpt] 
    PASS Check for TCP RPC Malfromaled response (Huge body length) [tests/025.phpt] 
    PASS Check for TCP RPC Malfromaled response (Malformaled error) [tests/026.phpt] 
    PASS Check for TCP RPC Malfromaled response (Not enough payload recved) [tests/027.phpt] 
    PASS Check for TCP RPC Malfromaled response (body_len too small) [tests/028.phpt] 
    PASS Check for TCP RPC Malfromaled response (incomplete header) [tests/029.phpt] 
    PASS Check for TCP RPC Exceptions [tests/030.phpt] 
    PASS Check for TCP client with server exit [tests/031.phpt] 
    PASS Check for yar client with huge request body [tests/032.phpt] 
    PASS Check for YAR_OPT_PROXY [tests/033.phpt] 
    PASS Check for Yar_Client::__cosntruct with options [tests/034.phpt] 
    PASS Check for yar concurrent reset [tests/035.phpt] 
    PASS Check for YAR_OPT_PROVIDER/TOKEN on tcp [tests/036.phpt] 
    PASS Check for YAR_OPT_PERSISTENT on tcp [tests/037.phpt] 
    PASS Check for YAR_OPT_TIMEOUT on tcp [tests/038.phpt] 
    PASS Check for debug on TCP [tests/039.phpt] 
    PASS Check for YAR_OPT_PACKAGER on curl [tests/040.phpt] 
    TEST 41/55 [tests/041.phpt]
    ========DIFF========
    001+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    001- Warning: Yar_Concurrent_Client::loop(): %rselect|epoll_wait%r timeout '100ms' reached in %s041.php on line %d
    002+ 
    003+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    004+ 
    005+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    006+ 
    007+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    008+ 
    009+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    010+ 
    011+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    012+ 
    013+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    014+ 
    015+ Warning: Yar_Concurrent_Client::loop(): [16] Timeout was reached in /work/GIT/pecl-and-ext/yar/tests/041.php on line 10
    ========DONE========
    FAIL Check for timeout of yar concurrent calls [tests/041.phpt] 
    PASS Check for maximum calls of yar concurrent call [tests/042.phpt] 
    PASS Check for yar server __info [tests/043.phpt] 
    PASS Check for yar server __info (public visiblity) [tests/045.phpt] 
    PASS Check for yar server __auth (public visiblity) [tests/046.phpt] 
    PASS Check for yar server __auth (concurrent call) [tests/047.phpt] 
    PASS Check for yar.expose_info off [tests/048.phpt] 
    PASS Check for yar.content_type [tests/049.phpt] 
    PASS Check for yar server __auth (throw exception) [tests/050.phpt] 
    PASS Check for yar server __auth (exit) [tests/051.phpt] 
    PASS Check for yar server __info (throw exception) [tests/052.phpt] 
    PASS Check for yar server __info (return none string) [tests/053.phpt] 
    PASS Check for yar server __info (exit) [tests/054.phpt] 
    PASS Bug #74867 (segment fault when use yar persistent call twice remote function) [tests/bug74867.phpt] 
    PASS ISSUE #172 $provider/$token may not be nullbyte-terminated [tests/issue172.phpt] 
    =====================================================================
    TIME END 2022-09-19 11:14:42
    
    =====================================================================
    TEST RESULT SUMMARY
    ---------------------------------------------------------------------
    Exts skipped    :    0
    Exts tested     :   36
    ---------------------------------------------------------------------
    
    Number of tests :   55                55
    Tests skipped   :    0 (  0.0%) --------
    Tests warned    :    0 (  0.0%) (  0.0%)
    Tests failed    :    1 (  1.8%) (  1.8%)
    Tests passed    :   54 ( 98.2%) ( 98.2%)
    ---------------------------------------------------------------------
    Time taken      :    3 seconds
    =====================================================================
    
    =====================================================================
    FAILED TEST SUMMARY
    ---------------------------------------------------------------------
    Check for timeout of yar concurrent calls [tests/041.phpt]
    =====================================================================
    
    
    opened by remicollet 0
  • Yar Server页面无法正常展示

    Yar Server页面无法正常展示

    image

    我使用的php版本是 PHP 8.1.7 (cli) (built: Jul 22 2022 18:22:48) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.7, Copyright (c) Zend Technologies

    使用Yar_Client调用的时候有乱码的错误. 把错误都关闭,依然如此. ini_set('display_errors', 0); error_reporting(0); yar 的版本从pecl安装的 2.3.2 替换成编译安装 2.3.0 都是一样的问题 image

    opened by liyuanwu2020 2
  • yar  400

    yar 400

    Uncaught Yar_Client_Transport_Exception: server responsed non-200 code '400' in /home/mycode/php_rpc/yar_rpc/client.php:6 Stack trace: #0 /home/mycode/php_rpc/yar_rpc/client.php(6): Yar_Client->__call() #1 {main} thrown in /home/mycode/php_rpc/yar_rpc/client.php on line 6

    opened by lvzhenchao 1
  • need specifical request method

    need specifical request method

    PHP 8.1.1 Centos 7.9 yar 2.2.1 yaf 3.3.4

        $RPCclient = new \Yar_Client(API_CONFIG . "/Brand/base");
        $result = $RPCclient->moGetMany('material_brand', [], [], '', $page, $pageSize, 1, 0);
    

    把Brand换成MaterialBrand就报错,可能是文件名和类名的原因 api.zip

    opened by Carlos-China 2
  • http2.0协议支持

    http2.0协议支持

    hi 鸟哥 我看到历史提交记录中yar有http2.0的支持 https://github.com/laruence/yar/commit/14daf8e97a1e9cbd5533715a9236f3039cca2eaa 然后在这个提交记录又 注释了 https://github.com/laruence/yar/commit/a2cd6440f784a583b2ebbb24166a3495d73d7262 我想请教一下, Yar是否有支持http2.0的计划? 注释的原因是? 是否yar http2.0的支持,除了设置libcurl这个参数还需要其他工作?还是出于其他目的考量注释的?

    以上,祝好

    opened by fangfengxiang 0
Owner
Xinchen Hui
PHP Stylite
Xinchen Hui
Flare is a PHP full-stack web framework that is light, fast, flexible, and secure.

Flare framework is a PHP full-stack web framework that is simple ,powerful , fast , flexible, and secure with long-term support.

Flare framework 3 Oct 24, 2022
CodeIgniter - a PHP full-stack web framework that is light, fast, flexible and secure

CodeIgniter 4 Development What is CodeIgniter? CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure. More informatio

CodeIgniter 4 web framework 4.5k Jan 4, 2023
A simple and light-weight PHP framework

A simple and light-weight PHP framework

Radhe Shyam Salopanthula 0 Jun 22, 2022
DoraRPC is an RPC For the PHP MicroService by The Swoole

Dora RPC 简介(Introduction) Dora RPC 是一款基础于Swoole定长包头通讯协议的最精简的RPC, 用于复杂项目前后端分离,分离后项目都通过API工作可更好的跟踪、升级、维护及管理。 问题提交: Issue For complex projects separation

Chang Long Xu 468 Jan 5, 2023
CleverStyle Framework is simple, scalable, fast and secure full-stack PHP framework

CleverStyle Framework is simple, scalable, fast and secure full-stack PHP framework. It is free, Open Source and is distributed under Free Public Lice

Nazar Mokrynskyi 150 Apr 12, 2022
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

null 14 Aug 14, 2022
PHPR or PHP Array Framework is a framework highly dependent to an array structure.

this is new repository for php-framework Introduction PHPR or PHP Array Framework is a framework highly dependent to an array structure. PHPR Framewor

Agung Zon Blade 2 Feb 12, 2022
I made my own simple php framework inspired from laravel framework.

Simple MVC About Since 2019, I started learning the php programming language and have worked on many projects using the php framework. Laravel is one

Rizky Alamsyah 14 Aug 14, 2022
Framework X is a simple and fast micro framework based on PHP

Framework X is a simple and fast micro framework based on PHP. I've created a simple CRUD application to understand how it works. I used twig and I created a custom middleware to handle PUT, DELETE methods.

Mahmut Bayri 6 Oct 14, 2022
Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components

Spiral HTTP Application Skeleton Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components.

Spiral Scout 152 Dec 18, 2022
Sunhill Framework is a simple, fast, and powerful PHP App Development Framework

Sunhill Framework is a simple, fast, and powerful PHP App Development Framework that enables you to develop more modern applications by using MVC (Model - View - Controller) pattern.

Mehmet Selcuk Batal 3 Dec 29, 2022
Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.

Framework X Framework X – the simple and fast micro framework for building reactive web applications that run anywhere. Quickstart Documentation Tests

Christian Lück 620 Jan 7, 2023
FuelPHP v1.x is a simple, flexible, community driven PHP 5.3+ framework, based on the best ideas of other frameworks, with a fresh start! FuelPHP is fully PHP 7 compatible.

FuelPHP Version: 1.8.2 Website Release Documentation Release API browser Development branch Documentation Development branch API browser Support Forum

Fuel 1.5k Dec 28, 2022
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.3.

Workerman What is it Workerman is an asynchronous event-driven PHP framework with high performance to build fast and scalable network applications. Wo

walkor 10.2k Dec 31, 2022
Fast php framework written in c, built in php extension

Yaf - Yet Another Framework PHP framework written in c and built as a PHP extension. Requirement PHP 7.0+ (master branch)) PHP 5.2+ (php5 branch) Inst

Xinchen Hui 4.5k Dec 28, 2022
💫 Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan / Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、WorkerMan

Mix Vega 中文 | English Vega is a CLI mode HTTP web framework written in PHP support Swoole, WorkerMan Vega 是一个用 PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、Work

Mix PHP 46 Apr 28, 2022
A PHP framework for web artisans.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

The Laravel Framework 72k Jan 7, 2023
The Symfony PHP framework

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Symfony is used by thousands of web applications (in

Symfony 27.8k Jan 2, 2023
Open Source PHP Framework (originally from EllisLab)

What is CodeIgniter CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable

B.C. Institute of Technology 18.2k Dec 29, 2022