Implementing and running clients

As the server is running, we now need to implement the clients. You should be familiar with this part, so I will just remind you of the most important parts, leaving something for you as homework.

Creating a client in PHP

When creating the client in PHP, we go through the standard procedure of including the required files, registering namespaces, and creating the connection:

#!/usr/bin/env php <?php define('THRIFT_PHP_LIB', __DIR__.'/thrift-0.9.2/lib/php/lib'); define('GEN_PHP_DIR', __DIR__.'/gen-php'); require_once THRIFT_PHP_LIB.'/Thrift/ClassLoader/ThriftClassLoader.php'; use Thrift\ClassLoader\ThriftClassLoader; $loader = new ThriftClassLoader(); $loader->registerNamespace('Thrift', THRIFT_PHP_LIB); // register ...

Get Learning Apache Thrift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.