blob: 994e6c94ac8805087e3ca4404508b0e670e0414e [file] [log] [blame]
Mark Slee5d06fea2007-03-05 22:18:18 +00001Thrift PHP Software Library
2
Mark Slee54b7ab92007-03-06 00:06:27 +00003Author: Mark Slee (mcslee@facebook.com)
4Last Modified: 2007-Mar-05
Mark Slee5d06fea2007-03-05 22:18:18 +00005
6Thrift is distributed under the Thrift open source software license.
7Please see the included LICENSE file.
8
9Using Thrift with PHP
10=====================
11
12Thrift requires PHP 5. Thrift makes as few assumptions about your PHP
13environment as possible while trying to make some more advanced PHP
14features (i.e. APC cacheing using asbolute path URLs) as simple as possible.
15
16To use Thrift in your PHP codebase, take the following steps:
17
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';
21
22Note that #3 must be done before including any other Thrift files.
23If you do not do #2, Thrift.php will set this global for you, but it will be
24done using dirname(__FILE__), which is less efficient than providing the static
25string yourself.
26
Mark Slee54b7ab92007-03-06 00:06:27 +000027When you generate a Thrift package using the compiler, it makes an assumption
28about where your generated code will live. If your file is "MyPackage.thrift",
29the generated files must be installed into:
30
31$GLOBALS['THRIFT_ROOT'].'/packages/MyPackage/';
32
33This allows the code generator to compile your code without any extra flags
34for the target directory names while still allowing your include paths to
35be absolute (if you have an absolute THRIFT_ROOT).
36
Mark Slee5d06fea2007-03-05 22:18:18 +000037Dependencies
38============
39
40PHP_INT_SIZE
41
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.
45
46apc_fetch(), apc_store()
47
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.