thriftclient Thrift client for Yii

  1. Requirements
  2. Usage
  3. Resources
  4. Change Log

PHP client for Thrift 0.5.0, for Yii.

As thrift is extensively used by Facebook, which is using PHP in frontend, I think that may prove that thrift is php friendly. So I choose to use it to communicate with python and java in my project.


Yii 1.1 or above


As a consumer of a thrift service, first you need to get the .thrift definition file, then using the thrift compiler generate interface files, as in Windows: ~~~ [shell] thrift.exe -gen php:oop service_defination.thrift ~~~ the generated files will be in a gen-php folder, a folder with the name of the php namespace definition in the .thrift file.

I assume you already extracted this extension at application.vendors directory, now copy the generated files to application.vendors.thrift.src.packages

Now add something in the config file:

'components' => array(



Configuration, it's done! Now you can use thrift in your code as this:


service_namespace is the namespace definition in the .thrift file, service_method is the method you want invoke in the service.

The client used TBufferedTransport as default transport, you can modify the ThriftClient.php around line 29 as you need


If you run into a problem, email me or leave a comment.

Change Log

  • thrift_0.2 Fix connection init bug, Add multiple service config support
3 0
Yii Version: 1.1
License: BSD-2-Clause
Category: Networking
Tags: client, thrift
Developed by: Leric
Created on: Jan 26, 2011
Last updated: 9 years ago


show all

Related Extensions