angejia/thrift-laravel
thrift-laravel
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
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
641,106,524
9,700
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
418,291,778
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
394,964,158
4,660
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 0.2.13 | >=7.0.0 | 5.1.*| | MIT | |
| 0.2.12 | >=7.0.0 | 5.1.* | MIT | |
| 0.2.11 | >=7.0.0 | 5.1.* | MIT | |
| 0.2.10 | >=7.0.0 | 5.1.* | MIT | |
| 0.2.9 | >=7.0.0 | 5.1.* | MIT | |
| 0.2.8 | >=7.0.0 | 5.1.* | MIT | |
| 0.2.4 | >=5.4.0 | 5.1.* | MIT | |
| 0.2.3 | >=5.4.0 | 5.1.* | MIT | |
| 0.2.2 | >=5.4.0 | 5.1.* | MIT | |
| 0.2.1 | >=5.4.0 | 5.1.* | MIT | |
| 0.2.0 | >=5.4.0 | 5.1.* | MIT | |
| 0.1.0 | >=5.4.0 | 5.1.* | MIT |