PHPackages                             lanffy/laravel-thrift-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. lanffy/laravel-thrift-plugin

ActiveLibrary[API Development](/categories/api)

lanffy/laravel-thrift-plugin
============================

thrift rpc server for laravel

0.0.1(7y ago)01PHPPHP &gt;=7.1.2

Since Nov 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/lanffy/laravel-thrift-plugin)[ Packagist](https://packagist.org/packages/lanffy/laravel-thrift-plugin)[ RSS](/packages/lanffy-laravel-thrift-plugin/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

thrift server
=============

[](#thrift-server)

Laravel Thrift 插件

如何使用
----

[](#如何使用)

### 服务端

[](#服务端)

1. `composer require lanffy/laravel-thrift-plugin`
2. 在配置`config/app.php->providers`中添加一行:`\Lanffy\Thrift\ThriftServiceProvider::class`
3. 在`app\Http\Kernel`中添加 Middleware `\Lanffy\Thrift\Middleware\ThriftServerMiddleware::class`,默认会处理`/rpc`上的请求,如果需要更改此规则,请继承此类并覆盖`process`方法
4. 在配置文件`config/thrift.php`中添加配置：

    ```
    return [
       'providers' => [
           [
               'Lanffy.Thrift.Express.HelloService', //thrift中定义的服务名
               ExpressService::class, // 服务实现类
           ],
           [
               'Lanffy.Thrift.Express.CalculateService', //多个服务按数组分开
               CalculateService::class,
           ],
        ],
    ];
    ```

### 客户端

[](#客户端)

1. `composer require lanffy/laravel-thrift-plugin`
2. 在配置`app.providers`中添加一行: `\Lanffy\Thrift\ThriftServiceProvider::class`
3. 在配置文件`config/thrift.php`中,设置`thrift.client`:

    ```
    return [
        'client' => [
            'http://thrift.server.com/rpc' => [ //服务地址
                'Lanffy.Thrift.Express.HelloService', //服务1名称
                'Lanffy.Thrift.Express.CalculateService', //服务2名称
            ],
        ],
    ];
    ```
4. 使用:

    ```
        /**
         * A basic test example.
         *
         * @return void
         */
        public function testBasicTest()
        {
            $this->assertTrue(true);
            /**
             * @var $a ThriftClient
             */
            $a = app(ThriftClient::class);

            /**
             * @var  $service \Lanffy\Thrift\Express\HelloServiceIf
             */
            $service = $a->with('Lanffy.Thrift.Express.HelloService');

            $result = $service->hello('test');
            $this->assertEquals($result, 'testtest');

            /**
             * @var  $calculateService \Lanffy\Thrift\Express\CalculateServiceIf
             */
            $calculateService = $a->with('Lanffy.Thrift.Express.CalculateService');
            $res = $calculateService->add(1,2);
            $this->assertEquals($res, 3);
        }
    ```

### 应用依赖

[](#应用依赖)

[![application](./application.jpg)](./application.jpg)

Inspired by [thrift-laravel](https://github.com/angejia/thrift-laravel)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2735d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/438ff3df356a2900c37210ccfba194b7aec38bebdd67dbd8d4b8a63ba53231b2?d=identicon)[lanffy](/maintainers/lanffy)

---

Top Contributors

[![lanffy](https://avatars.githubusercontent.com/u/5475423?v=4)](https://github.com/lanffy "lanffy (2 commits)")

---

Tags

laravelrpcthrift

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lanffy-laravel-thrift-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/lanffy-laravel-thrift-plugin/health.svg)](https://phpackages.com/packages/lanffy-laravel-thrift-plugin)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)[joggapp/laravel-aws-sns

Laravel package for the SNS events by AWS

3171.8k](/packages/joggapp-laravel-aws-sns)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
