| Mark Slee | 5d06fea | 2007-03-05 22:18:18 +0000 | [diff] [blame] | 1 | Thrift PHP Software Library | 
|  | 2 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 3 | Author: Mark Slee (mcslee@facebook.com) | 
|  | 4 | Last Modified: 2007-Mar-05 | 
| Mark Slee | 5d06fea | 2007-03-05 22:18:18 +0000 | [diff] [blame] | 5 |  | 
|  | 6 | Thrift is distributed under the Thrift open source software license. | 
|  | 7 | Please see the included LICENSE file. | 
|  | 8 |  | 
|  | 9 | Using Thrift with PHP | 
|  | 10 | ===================== | 
|  | 11 |  | 
|  | 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. | 
|  | 15 |  | 
|  | 16 | To 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 |  | 
|  | 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. | 
|  | 26 |  | 
| Mark Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 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: | 
|  | 30 |  | 
|  | 31 | $GLOBALS['THRIFT_ROOT'].'/packages/MyPackage/'; | 
|  | 32 |  | 
|  | 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). | 
|  | 36 |  | 
| Mark Slee | 5d06fea | 2007-03-05 22:18:18 +0000 | [diff] [blame] | 37 | Dependencies | 
|  | 38 | ============ | 
|  | 39 |  | 
|  | 40 | PHP_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 |  | 
|  | 46 | apc_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. |