2017 © Pedro Peláez
 

library thrift

让Thrift使用起来更简洁

image

sean-ren/thrift

让Thrift使用起来更简洁

  • Monday, December 14, 2015
  • by longfeiRen
  • Repository
  • 1 Watchers
  • 0 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Thrift Client Api for PHP

整合Thrift官方提供的包,融合workerman客户端连接并对其进行优化。, (*1)

包加载说明

修改composer.json, (*2)

"require": {
    "sean-ren/thrift"   : "0.9.*"
}

根据Thrift idl生成客户端代码,生成命令示例:, (*3)

thrift --gen php message.thrift

然后加载客户端代码,可以通过composer加载;修改composer.json:, (*4)

"autoload" : {
        "classmap" : ["客户端代码目录"]
}

如果对composer自动加在不熟悉可以参考composer手册, (*5)

使用示例

use Thrift\Clients\ThriftClient,
     example\Message;
ThriftClient::config(array(
                        'MessageService' => array(
                            'addresses' => array(
                               '127.0.0.1:9001'
                            ),
                            'thrift_protocol' => 'TCompactProtocol',//不配置默认是TBinaryProtocol,对应服务端Message.conf配置中的thrift_protocol
                            'thrift_transport' => 'TFramedTransport',//不配置默认是TBufferedTransport,对应服务端Message.conf配置中的thrift_transport
                            "namespace_name" => "\\example\\MessageServiceClient",
                            "service_dir" => "yourpath/example" //如果不想使用命名空间可以填写路径自动加载
                        ),
                    )
                );
$client = ThriftClient::instance("MessageService");

The Versions

14/12 2015

dev-master

9999999-dev

让Thrift使用起来更简洁

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php thrift

08/12 2015

0.9.4.x-dev

0.9.4.9999999-dev

让Thrift使用起来更简洁

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php thrift