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