| Mark Slee | 5d06fea | 2007-03-05 22:18:18 +0000 | [diff] [blame] | 1 | Thrift PHP Software Library | 
 | 2 |  | 
| Mark Slee | 5d06fea | 2007-03-05 22:18:18 +0000 | [diff] [blame] | 3 | Thrift is distributed under the Thrift open source software license. | 
 | 4 | Please see the included LICENSE file. | 
 | 5 |  | 
 | 6 | Using Thrift with PHP | 
 | 7 | ===================== | 
 | 8 |  | 
 | 9 | Thrift requires PHP 5. Thrift makes as few assumptions about your PHP | 
 | 10 | environment as possible while trying to make some more advanced PHP | 
 | 11 | features (i.e. APC cacheing using asbolute path URLs) as simple as possible. | 
 | 12 |  | 
 | 13 | To use Thrift in your PHP codebase, take the following steps: | 
 | 14 |  | 
 | 15 | #1) Copy all of thrift/lib/php/src into your PHP codebase | 
 | 16 | #2) Set $GLOBALS['THRIFT_ROOT'] to the path you installed Thrift | 
 | 17 | #3) include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php'; | 
 | 18 |  | 
 | 19 | Note that #3 must be done before including any other Thrift files. | 
 | 20 | If you do not do #2, Thrift.php will set this global for you, but it will be | 
 | 21 | done using dirname(__FILE__), which is less efficient than providing the static | 
 | 22 | string yourself. | 
 | 23 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 24 | When you generate a Thrift package using the compiler, it makes an assumption | 
 | 25 | about where your generated code will live. If your file is "MyPackage.thrift", | 
 | 26 | the generated files must be installed into: | 
 | 27 |  | 
 | 28 | $GLOBALS['THRIFT_ROOT'].'/packages/MyPackage/'; | 
 | 29 |  | 
 | 30 | This allows the code generator to compile your code without any extra flags | 
 | 31 | for the target directory names while still allowing your include paths to | 
 | 32 | be absolute (if you have an absolute THRIFT_ROOT). | 
 | 33 |  | 
| Mark Slee | 5d06fea | 2007-03-05 22:18:18 +0000 | [diff] [blame] | 34 | Dependencies | 
 | 35 | ============ | 
 | 36 |  | 
 | 37 | PHP_INT_SIZE | 
 | 38 |  | 
 | 39 |   This built-in signals whether your architecture is 32 or 64 bit and is | 
 | 40 |   used by the TBinaryProtocol to properly use pack() and unpack() to | 
 | 41 |   serialize data. | 
 | 42 |  | 
 | 43 | apc_fetch(), apc_store() | 
 | 44 |  | 
 | 45 |   APC cache is used by the TSocketPool class. If you do not have APC installed, | 
 | 46 |   Thrift will fill in null stub function definitions. |