2017 © Pedro Peláez
 

library tcp4p

Thrift Client Pool For PHP

image

tonydeng/tcp4p

Thrift Client Pool For PHP

  • Friday, March 25, 2016
  • by tonydeng
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 50 % Grown

The README.md

TCP4P (Thrift Client Pool For PHP)

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

包加载说明

修改composer.json, (*2)

"require": {
    "tonydeng/tcp4p"    : "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

25/03 2016

dev-master

9999999-dev

Thrift Client Pool For PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Tony Deng

php thrift tcp4p

25/03 2016

1.0.1

1.0.1.0

Thrift Client Pool For PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Tony Deng

php thrift tcp4p

25/03 2016

dev-develop

dev-develop

Thrift Client Pool For PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Tony Deng

php thrift tcp4p

24/03 2016

1.0.0

1.0.0.0

TCP4P (Thrift Client Pool For PHP)

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Tony Deng

php thrift tcp4p