PHP code example of eleme / thrift-silex

1. Go to this page and download the library: Download eleme/thrift-silex library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eleme / thrift-silex example snippets


use Silex\Application;
use Eleme\Thrift\Provider\Silex\ThriftServiceProvider;

$app = new Application;
$app->register(new ThriftServiceProvider);
$app['thrift.options'] = array(
    'foo' => array(
        'server' => 'foo_host',
        'port' => 12345,
        'client' => 'FooClient'
    ),
    'bar' => array(
        'server' => 'bar_host',
        'port' => 12346,
        'client' => 'BarClient'
    ),
);
$app['thrift.clients']['foo']->api();
$app['thrift.clients']['bar']->api();