2017 © Pedro Peláez
 

symfony-bundle thrift-bundle

OverBlog Thrift Bundle

image

overblog/thrift-bundle

OverBlog Thrift Bundle

  • Thursday, March 15, 2018
  • by Overblog
  • Repository
  • 30 Watchers
  • 42 Stars
  • 11,169 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 1 Open issues
  • 22 Versions
  • 1 % Grown

The README.md

OverBlog Thrift Bundle

Build Status, (*1)

What is this repository ?

This is a custom version of the Thrift protocol for PHP, (*2)

https://github.com/yuxel/thrift-examples, (*3)

http://svn.apache.org/repos/asf/thrift/trunk/, (*4)

Getting the bundle

The Composer way

Update your composer json with this new dependency into the "require" section., (*5)

// composer.json
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.1.*",
    ...
    "overblog/thrift-bundle": "*" // insert this line
}

And then run composer update, (*6)

Setting up the bundle

Let's start by registering the bundle into the AppKernel, (*7)

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        ...
        new Overblog\ThriftBundle\OverblogThriftBundle(),
        ...
    );

    return $bundles;
}

You can now create your Service.thrift file and place it in a ThriftDefinition directory, in your own bundle., (*8)

For example: MyNameSpace/MyBundle/ThriftDefinition/Service.thrift, (*9)

You need to configure the compiler to build the right files., (*10)

#app/config/config.yml
  overblog_thrift:
    services:
      *service_name*:
        definition: Service
        namespace: ThriftModel\Service
        definitionPath: /PATH/ # Path of the definition
        server: true    # Define if server class will be generated

You are now able to generate the model with php app/console thrift:compile CompleteBundleName Service, (*11)

Model will be automatically generated on the cache warmup (php app/console cache:warmup) in your cache directory., (*12)

You can set in the option "protocol" too, (*13)

To use server

Create your handler that extends Overblog\ThriftBundle\Api\Extensions\BaseExtension and implements ThriftModel\Service\ServiceIf. Then register it in your bundle:, (*14)

#Bundle/Ressources/config/services.yml
    services:
      thrift.handler.service:
        class: BundleName\Handler\Service
        arguments: [@service_container]

Add the server config to your project's config.yml:, (*15)

#app/config/config.yml
    overblog_thrift:
      servers:
        *service_name*:
          service: *service_name*
          handler: thrift_api.processor.service

If you wan't to use Thrift over HTTP Transport, you must add the bundle's routing to your project., (*16)

#app/config/routing.yml
    OverblogThriftBundle:
      resource: "@OverblogThriftBundle/Resources/config/routing.yml"
      prefix:   /

Or you can start the socket version with the command:, (*17)

php app/console thrift:server *service_name*

To use client

HTTP Client: Add this to your projects's config.yml :, (*18)

#app/config/config.yml
  overblog_thrift:
    clients:
      *client_name*:
        service: *service_name*:
        type: http
        hosts:
          comment:
            host: domain/thrift
            port: 80

Socket Client: Add this to your projects's config.yml :, (*19)

#app/config/config.yml
  overblog_thrift:
    clients:
      *client_name*:
        service: *service_name*:
        type: socket
        hosts:
          *host_name*:
            host: localhost
            port: 9090

Multi Socket Client: Add this to your projects's config.yml :, (*20)

#app/config/config.yml
  overblog_thrift:
    clients:
      *client_name*:
        service: *service_name*:
        type: socket
        hosts:
          *host_name*:
            host: localhost
            port: 9090
          *host_name_2*:
            host: localhost
            port: 9091

Then you can call the client:, (*21)

// your_controller.php

$service = $this->getContainer()->get('thrift.client.*client_name*');
$client = $service->getClient();

$service = $service->getFactory('ThriftModel\Service\Service');
$service->property = 121354984651354647;
$service->name = 'Name 1';

$id = $client->execMethod($service);

Contribute

Tests:, (*22)

Install phpunit., (*23)

In the bundle directory:, (*24)

phpunit

The Versions

12/09 2017

0.9.14

0.9.14.0 https://github.com/overblog/ThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

06/09 2017

0.9.13

0.9.13.0 https://github.com/overblog/ThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

28/07 2017

0.9.12

0.9.12.0 https://github.com/overblog/ThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

13/09 2016

dev-sf_2_3

dev-sf_2_3 https://github.com/overblog/ThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

08/02 2016
30/03 2015
14/01 2015
03/12 2014

0.9.9

0.9.9.0 https://github.com/overblog/ThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

10/04 2014

0.9.8

0.9.8.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

28/03 2014

0.9.7

0.9.7.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

25/02 2014

0.9.6

0.9.6.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

23/08 2013

0.9.5

0.9.5.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

05/08 2013

0.9.4

0.9.4.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

MIT

The Requires

 

12/04 2013

0.9.3

0.9.3.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

The Requires

 

14/01 2013

0.9.2

0.9.2.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

The Requires

 

25/11 2012

0.9.0

0.9.0.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

The Requires

 

24/10 2012

v0.8.5

0.8.5.0 https://github.com/ebuzzing/OverblogThriftBundle.git

OverBlog Thrift Bundle

  Sources   Download

The Requires