PHPackages                             evondu/yii2-thrift - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. evondu/yii2-thrift

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

evondu/yii2-thrift
==================

06PHP

Since Jan 10Pushed 7y agoCompare

[ Source](https://github.com/EvonDu/yii2-thrift)[ Packagist](https://packagist.org/packages/evondu/yii2-thrift)[ RSS](/packages/evondu-yii2-thrift/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-thrift
===========

[](#yii2-thrift)

项目介绍
----

[](#项目介绍)

本项目用于在Yii框架下，进行Thrift服务端开发。

安装方法
----

[](#安装方法)

`composer require evondu/yii2-thrift:dev-master`

配置方法
----

[](#配置方法)

- 替换`app/web/index.php`中的Application类：`yii\web\Application`=&gt;`YiiThrift\Application`
- 在`app/config/main.php`中配置thrift组件：
    - path默认为应用目录下的gen-php
    - definitions为空时，会自动扫描加载gen-php目录下的所有文件夹
    - serviceMap为空时，会自动扫描加载服务名空间目录下的所有类
    - 配置例子如下：

```
'components' =>
[
    //……
    'thrift' => [
        //thrift文件生成路径（默认为应用目录下的gen-php）
        'path' => "",
        //配置名空间对应目录(名空间 => 对应目录)(相对于生成目录)
        'definitions' => [
            'thybot' => "thybot"
        ],
        //配置服务名空间（相当于配置控制器名空间）
        'serviceNamespace' => 'api_thrift\services',
        //配置服务名映射(服务名 => 服务名空间目录下的服务类)
        'serviceMap' => [
            'DemoService' => 'DemoService',
        ],
    ]
    //……
],

```

- 实现Service类
    - 在配置的`serviceNamespace`下添加Service类
    - Service类必须实现两个接口，一个是thrift编译生成的服务If接口，一个是`YiiThrift\ThriftServerInterface`
    - 实现例子如下：

```

```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bfc78ed4e60da9a8edecf6b9bad9a193781b472a77aa2c5f84ee296ffc681e07?d=identicon)[EvonDu](/maintainers/EvonDu)

---

Top Contributors

[![EvonDu](https://avatars.githubusercontent.com/u/26706325?v=4)](https://github.com/EvonDu "EvonDu (1 commits)")

### Embed Badge

![Health badge](/badges/evondu-yii2-thrift/health.svg)

```
[![Health](https://phpackages.com/badges/evondu-yii2-thrift/health.svg)](https://phpackages.com/packages/evondu-yii2-thrift)
```

###  Alternatives

[cubeta/cubeta-starter

Cubeta-Starter: A developer's Swiss army knife for seamless CRUD operations. Choose between core integration or dev dependency. Enjoy a user-friendly GUI for code generation, enhancing your development workflow. Say goodbye to repetition, embrace productivity with Cubeta-Starter!

122.2k](/packages/cubeta-cubeta-starter)

PHPackages © 2026

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