THRIFT-1615 PHP Namespace (was Thrift for Symfony 2)
Patch: Xavier HAUSHERR


git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1381323 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/README.apache b/lib/php/README.apache
index 8c41833..5e92589 100644
--- a/lib/php/README.apache
+++ b/lib/php/README.apache
@@ -32,18 +32,30 @@
 
 <?php
 
+namespace MyNamespace;
+
+/**
+ * Include path
+ */
+$THRIFT_ROOT = '/your/thrift/root/lib';
+
+/**
+ * Init Autloader
+ */
+require_once $THRIFT_ROOT . '/Thrift/ClassLoader/ThriftClassLoader.php';
+
+$loader = new ThriftClassLoader();
+$loader->registerNamespace('Thrift', $THRIFT_ROOT);
+$loader->registerDefinition('Thrift', $THRIFT_ROOT . '/packages');
+$loader->register();
+
+use Thrift\Transport\TPhpStream;
+use Thrift\Protocol\TBinaryProtocol;
+
 /**
  * Example of how to build a Thrift server in Apache/PHP
- *
  */
 
-$GLOBALS['THRIFT_ROOT'] = '/your/thrift/root';
-
-include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
-include_once $GLOBALS['THRIFT_ROOT'].'/packages/Service/Service.php';
-include_once $GLOBALS['THRIFT_ROOT'].'/transport/TPhpStream.php';
-include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
-
 class ServiceHandler implements ServiceIf {
   // Implement your interface and methods here
 }