tengpao/yii2-thrift

yii2的thrift扩展

安装: 14

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 1

分支: 0

开放问题: 0

类型:yii2-extension

dev-master 2016-06-22 16:15 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:58:48 UTC


README

yii2的thrift扩展

安装

安装此扩展的首选方式是通过composer,可以运行

composer require --prefer-dist tengpao/yii2-thrift "*"

或者将

"tengpao/yii2-thrift": "*"

添加到您的composer.json文件的require部分。

使用

在配置文件components中增加配置

'thrift' => [
    'class' => 'tengpao\thrift\ThriftClient'
    'idService' => [
        'defineName' => 'shared',
        'clientName' => '\tutorial\CalculatorClient'
    ],
]

调用

\Yii::$app->thrift->idService->method();

如果不希望在配置文件中全局配置,可以使用

$thrift = \Yii::createObject([
    'class' => 'tengpao\thrift\ThriftClient'
    'idService' => [
        'defineName' => 'shared',
        'clientName' => '\tutorial\CalculatorClient'
    ],
]);

$thrift->idService->method();

注意,如果不是通过composer安装的,需要添加相关别名指向

QQ交流群: 325914002