PHP code example of gtt / thrift-generator

1. Go to this page and download the library: Download gtt/thrift-generator 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/ */

    

gtt / thrift-generator example snippets


use Gtt\ThriftGenerator\Generator\ThriftGenerator;

$generator = new ThriftGenerator();
$generator
    // set classes that should be introspected in order to generate thrift definition files
    ->setClasses(
        array(
            new ReflectionClass("\Your\Class\Name"),
            new ReflectionClass("\Another\Class\Name")
        )
    )
    // set output dir
    ->setOutputDir("<path to folder that will contain generated thrift definitions>")
    // generate!
    ->generate();