Apache Thrift Hello World with PHP and Python Part 1

In the previous post, I shared you the way how to install Apache Thrift in Ubuntu server. And now, I am writing the first application named Hello World with Apache Thrift in Python and Laravel 4.2

Concept:

You could clone full source from here: https://github.com/thanhson1085/thrift-laravel

Please download the source code before reading next steps.

You never know how strong you are, until being strong is your only choice

You never know how strong you are, until being strong is your only choice

Step 1: Create thrift files hello.thirft and exceptions.thrift

hello.thrift:

exceptions.thrift:

Step 2:  Run thrift compiler command to generate source code

See the details at gen.sh file

Step 3: Code the server-side

Code Hello Server hello-server.py (located src/python directory):

Create Hander hander.py located in src/python/hello:

Step 4: Run a test

Finally, test the server with server.sh script:

The output will be as below:

That means that you created server-side successfully.

Please keep reading Part 2 to know how to code the client-side with PHP Laravel 4.2