angejia/thrift-laravel
Composer 安装命令:
composer require angejia/thrift-laravel
包简介
use Thrift in Laravel
README 文档
README
use Thrift in Laravel
How to use
Server side
-
composer require angejia/thrift-laravel -
add provider to
app.providers:\Angejia\Thrift\ThriftServiceProvider::class -
setting
thrift.providersin fileconfig/thrift.php:// first is service name, defined in thrift file // second in Service implement reference, e.g. // class ImageServcie implement \Angejia\ImageServiceIf ['Angejia.ImageService', \Angejia\ImageService::class], -
add Middleware
\Angejia\Thrift\Middleware\ThriftServerMiddleware::classtoapp\Http\Kernelin default, the request to
/rpcwill be process by Middleware, if you want to change this, please extendThriftServerMiddlewareand overwriteprocessmethod
Client side
composer require angejia/thrift-laravel- add provider in
app.providers:\Angejia\Thrift\ThriftServiceProvider::class - setting
thrift.dependsin fileconfig/thrift.php:// key is url // value is array of service name "http://localhost/rpc" => [ 'Angejia.ImageService', ] - usage:
/** @var \Angejia\Thrift\Contracts\ThriftClient $thriftClient */ $thriftClient = app(\Angejia\Thrift\Contracts\ThriftClient::class); /** @var \Angejia\ImageServiceIf $imageService */ $imageService = $thriftClient->with('Angejia.ImageService'); $result = $imageService->foo();
TODO
- Unittest
统计信息
- 总下载量: 1.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-29