Skip to content
Newer
Older
100644 111 lines (80 sloc) 2.08 KB
d3b00be @johnj initial commit
authored May 16, 2012
1 php5-xcom
2 =========
3
a3fea03 @johnj update README
authored Sep 25, 2012
4 X.commerce message handling extension for PHP5 (www.x.com)
db79496 @johnj Updated README w/examples and install
authored May 19, 2012
5
6 Installing/Configuring
7 ======================
8
9 Debian pkg's are provided under debs/
10
11 <pre>
12 $ phpize && ./configure
13 $ make && sudo make install
14 # echo "extension=xcom.so" >> /your/php.ini
15 </pre>
16
1bc4bc8 @johnj Add libavro instructions
authored Aug 10, 2012
17 A gcc-like toolchain, php headers, and libavro (installation instructions below) are required.
db79496 @johnj Updated README w/examples and install
authored May 19, 2012
18
e71b46d @johnj Windows build
authored Sep 7, 2012
19 Pre-compiled Windows binaries can be found @ https://github.com/johnj/php5-xcom/downloads
20
db79496 @johnj Updated README w/examples and install
authored May 19, 2012
21 Examples
22 ========
23 Sending a message to X.commerce:
24 ```php
25 <?php
26
27 $data = new stdClass();
28 $data->member_id = 123495585343;
29
30 $xcom = new Xcom("http://api.sandbox.x.com/fabric/", "fabric_token",
31 "capability_token");
32
f22e28d @johnj Updating README.md w/new examples
authored Jun 11, 2012
33 var_dump($xcom->send("/topic/", $data, '{"json": "schema"}'));
34
35 /*
36 * Output:
37 * int(200)
38 */
db79496 @johnj Updated README w/examples and install
authored May 19, 2012
39
40 ?>
41 ```
42
43 Receiving a message from X.commerce:
44 ```php
45 <?php
46
47 $xcom = new Xcom("http://api.sandbox.x.com/fabric/", "fabric_token",
48 "capability_token");
49
f22e28d @johnj Updating README.md w/new examples
authored Jun 12, 2012
50 var_dump($xcom->decode(file_get_contents("php://input"), '{"json": "schema"}'));
db79496 @johnj Updated README w/examples and install
authored May 19, 2012
51
f22e28d @johnj Updating README.md w/new examples
authored Jun 12, 2012
52 /*
53 * Output:
54 * object(stdClass)#87 (2) { ["username"]=> string(2) "hi" ["active"]=> int(38347473) }
55 */
db79496 @johnj Updated README w/examples and install
authored May 19, 2012
56 ?>
57 ```
2013ffe @johnj Update debugging example
authored Jul 12, 2012
58 Debugging:
7f80ce2 @johnj Add debug example
authored May 22, 2012
59 ```php
60 <?php
61
62 $xcom = new Xcom("http://api.sandbox.x.com/fabric/", "fabric_token",
63 "capability_token");
64
65 $xcom->__debug = true;
66
2013ffe @johnj Update debugging example
authored Jul 12, 2012
67 $xcom->send($topic, $data, '{"json": "schema"}');
68 var_dump($xcom->getDebugOutput());
69
7f80ce2 @johnj Add debug example
authored May 23, 2012
70 ?>
f22e28d @johnj Updating README.md w/new examples
authored Jun 12, 2012
71 ```
72
73 Encoding a message:
74 ```php
75 <?php
76
77 $data = new stdClass();
78 $data->member_id = 123495585343;
79
80 $xcom = new Xcom("http://api.sandbox.x.com/fabric/", "fabric_token",
81 "capability_token");
82
83 var_dump($xcom->encode($data, '{"json": "schema"}'));
84
85 /*
86 * Output:
87 * a binary string that contains an avro message, which can be POST'ed to
88 * X.Commerce
89 */
90
91 ?>
92 ```
1bc4bc8 @johnj Add libavro instructions
authored Aug 10, 2012
93
94 libavro
95 ========
96 In order to compile the xcommerce extension you will need libavro.
97
b5d9721 @johnj Windows build fix, remove trailing slashes
authored Sep 14, 2012
98 The libavro build uses CMake (available in most package managers).
1bc4bc8 @johnj Add libavro instructions
authored Aug 10, 2012
99
100 <pre>
101 $ git clone https://github.com/johnj/avro.git
102 $ cd avro/lang/c
103 $ cmake .
104 $ sudo make install
105 </pre>
56881e5 @johnj Add note in README about SSL certs (via @ppalavilli)
authored Aug 20, 2012
106
107 SSL Certificates
108 ================
109 If you run into issues with SSL negotiation, you can try to get the CA certs available
110 @ http://curl.haxx.se/docs/caextract.html
Something went wrong with that request. Please try again.