Subversion Repositories SmartDukaan

Rev

Rev 30 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
30 ashish 1
Thrift PHP Software Library
2
 
3
License
4
=======
5
 
6
Licensed to the Apache Software Foundation (ASF) under one
7
or more contributor license agreements. See the NOTICE file
8
distributed with this work for additional information
9
regarding copyright ownership. The ASF licenses this file
10
to you under the Apache License, Version 2.0 (the
11
"License"); you may not use this file except in compliance
12
with the License. You may obtain a copy of the License at
13
 
14
  http://www.apache.org/licenses/LICENSE-2.0
15
 
16
Unless required by applicable law or agreed to in writing,
17
software distributed under the License is distributed on an
18
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19
KIND, either express or implied. See the License for the
20
specific language governing permissions and limitations
21
under the License.
22
 
23
Using Thrift with PHP
24
=====================
25
 
26
Thrift requires PHP 5. Thrift makes as few assumptions about your PHP
27
environment as possible while trying to make some more advanced PHP
28
features (i.e. APC cacheing using asbolute path URLs) as simple as possible.
29
 
30
To use Thrift in your PHP codebase, take the following steps:
31
 
32
#1) Copy all of thrift/lib/php/src into your PHP codebase
33
#2) Set $GLOBALS['THRIFT_ROOT'] to the path you installed Thrift
34
#3) include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php';
35
 
36
Note that #3 must be done before including any other Thrift files.
37
If you do not do #2, Thrift.php will set this global for you, but it will be
38
done using dirname(__FILE__), which is less efficient than providing the static
39
string yourself.
40
 
41
When you generate a Thrift package using the compiler, it makes an assumption
42
about where your generated code will live. If your file is "MyPackage.thrift",
43
the generated files must be installed into:
44
 
45
$GLOBALS['THRIFT_ROOT'].'/packages/MyPackage/';
46
 
47
This allows the code generator to compile your code without any extra flags
48
for the target directory names while still allowing your include paths to
49
be absolute (if you have an absolute THRIFT_ROOT).
50
 
51
Dependencies
52
============
53
 
54
PHP_INT_SIZE
55
 
56
  This built-in signals whether your architecture is 32 or 64 bit and is
57
  used by the TBinaryProtocol to properly use pack() and unpack() to
58
  serialize data.
59
 
60
apc_fetch(), apc_store()
61
 
62
  APC cache is used by the TSocketPool class. If you do not have APC installed,
63
  Thrift will fill in null stub function definitions.