| Package Data | |
|---|---|
| Maintainer Username: | angejia |
| Package Create Date: | 2016-08-29 |
| Package Last Update: | 2016-09-19 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-04 15:02:56 |
| Package Statistics | |
|---|---|
| Total Downloads: | 1,788 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 11 |
| Total Watchers: | 2 |
| Total Forks: | 7 |
| Total Open Issues: | 2 |
use Thrift in Laravel
composer require angejia/thrift-laravel
add provider to app.providers:
\Angejia\Thrift\ThriftServiceProvider::class
setting thrift.providers in file config/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::class to app\Http\Kernel
in default, the request to /rpc will be process by Middleware,
if you want to change this, please extend ThriftServerMiddleware and overwrite process method
composer require angejia/thrift-laravel
app.providers:
\Angejia\Thrift\ThriftServiceProvider::class
thrift.depends in file config/thrift.php:
// key is url
// value is array of service name
"http://localhost/rpc" => [
'Angejia.ImageService',
]
/** @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();