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 2w 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 13% 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

2786d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5475423?v=4)[Lanffy](/maintainers/lanffy)[@lanffy](https://github.com/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

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[illuminate/routing

The Illuminate Routing package.

1239.0M2.9k](/packages/illuminate-routing)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[essa/api-tool-kit

set of tools to build an api with laravel

53386.5k](/packages/essa-api-tool-kit)

PHPackages © 2026

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