PHPackages                             rangelreale/yii2-nithrift - 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. rangelreale/yii2-nithrift

ActiveYii2-extension

rangelreale/yii2-nithrift
=========================

Thrift server application using Yii2

16PHP

Since Jan 14Pushed 10y ago1 watchersCompare

[ Source](https://github.com/RangelReale/yii2-nithrift)[ Packagist](https://packagist.org/packages/rangelreale/yii2-nithrift)[ RSS](/packages/rangelreale-yii2-nithrift/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-nithrift
=============

[](#yii2-nithrift)

Thrift extension for Yii2

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist RangelReale/yii2-nithrift "*"

```

or add

```
"RangelReale/yii2-nithrift": "*"

```

Minimum Requirement
===================

[](#minimum-requirement)

- Thrift version 0.9.3. To install thrift, check
- Yii 2.0.0

Usage
=====

[](#usage)

The Thrift base classes must be accessible someway. I put the thrift/lib/php/lib path in my application root, and add this to composer.json:

```
"autoload": {
    "psr-0": {
        "Thrift": "lib"
    }
}

```

Create a directory named `generated` in your application root. Put your .thrift files into it, and generate the php wrapper on the default gen-php path, using command below.

```
thrift --gen php:server path/to/the/thrift/file

```

The files should be like this:

```
-- ROOT
    -- config
    -- controllers
    -- generated
        file1.thrift
        file2.thrift
        -- gen-php
            -- file1
            -- file2
    ...

```

In the component configuration add the `thrift` component, with the Thrift definitions.

```
return [
    'component' => [
        'thrift' => [
            'class' => 'RangelReale\nithrift\Thrift',
            'definitions' => [
                'shared',
                'tutorial',
            ],
        ]
    ]
]
```

Implement your Thrift handlers in separate class files, following the thrift documentation. I recommend using a `services` directory on the application root. There is no need to override or implement any other interface.

Your controller should extend `\RangelReale\nithrift\Controller`. You can use the custom `\RangelReale\nithrift\Action` class to implement the services.

```
class ApiController extends \RangelReale\nithrift\Controller
{
    public function actions()
    {
        return [
            'calculator' => [
                'class' => 'RangelReale\nithrift\Action',
                'handler' => 'app\services\CalculatorHandler',
                'processor' => 'tutorial\CalculatorProcessor',
            ]
        ];
    }
}
```

If you prefer, you can implement an inline action, and either return a `\RangelReale\nithrift\Response` object, or a processor object directly.

```
public function actionCalculator()
{
    $handler = new \app\services\CalculatorHandler();
    $processor = new \tutorial\CalculatorProcessor($handler);

    return new ThriftResponse($processor); // could be `return $processor;`
}
```

Author
======

[](#author)

Rangel Reale ()

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/80ab1356ebb8906588f43edab9d6b94e25bae45f70d46502897d62b447cb2dff?d=identicon)[RangelReale](/maintainers/RangelReale)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/rangelreale-yii2-nithrift/health.svg)

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

PHPackages © 2026

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