blob: 76479b3ca36e7974cc9ea80891a958be778f5684 [file] [log] [blame]
Mark Slee5d06fea2007-03-05 22:18:18 +00001Thrift PHP Software Library
2
Mark Slee5d06fea2007-03-05 22:18:18 +00003Thrift is distributed under the Thrift open source software license.
4Please see the included LICENSE file.
5
6Using Thrift with PHP
7=====================
8
9Thrift requires PHP 5. Thrift makes as few assumptions about your PHP
10environment as possible while trying to make some more advanced PHP
11features (i.e. APC cacheing using asbolute path URLs) as simple as possible.
12
13To 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
19Note that #3 must be done before including any other Thrift files.
20If you do not do #2, Thrift.php will set this global for you, but it will be
21done using dirname(__FILE__), which is less efficient than providing the static
22string yourself.
23
Mark Slee54b7ab92007-03-06 00:06:27 +000024When you generate a Thrift package using the compiler, it makes an assumption
25about where your generated code will live. If your file is "MyPackage.thrift",
26the generated files must be installed into:
27
28$GLOBALS['THRIFT_ROOT'].'/packages/MyPackage/';
29
30This allows the code generator to compile your code without any extra flags
31for the target directory names while still allowing your include paths to
32be absolute (if you have an absolute THRIFT_ROOT).
33
Mark Slee5d06fea2007-03-05 22:18:18 +000034Dependencies
35============
36
37PHP_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
43apc_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.