Simplify code generated by wrap_php_function; make sure its closure version is identi...
[plcapi.git] / INSTALL.md
1 XMLRPC for PHP
2
3 Requirements
4 ------------
5
6 The following requirements should be met prior to using 'XMLRPC for PHP':
7
8 * PHP 5.3.0 or later
9
10 * the php "curl" extension is needed if you wish to use SSL or HTTP 1.1 to
11   communicate with remote servers
12
13 The php "xmlrpc" native extension is not required, but if it is installed,
14 there will be no interference with the operation of this library.
15
16
17 Installation instructions
18 -------------------------
19
20 Installation of the library is quite easy:
21
22 1.  Via Composer (highly recommended):
23
24     1.  Install composer if you don't have it already present on your system.
25         Depending on how you install, you may end up with a composer.phar file in your directory.
26         In that case, no worries! Just substitute 'php composer.phar' for 'composer' in the commands below.
27
28     2.  If you're creating a new project, create a new empty directory for it.
29
30     3.  Open a terminal and use Composer to grab the library.
31
32             $ composer require phpxmlrpc/phpxmlrpc:4.0
33
34     4.  Write your code.
35         Once Composer has downloaded the component(s), all you need to do is include the vendor/autoload.php file that
36         was generated by Composer. This file takes care of autoloading all of the libraries so that you can use them
37         immediately, including phpxmlrpc:
38
39             // File example: src/script.php
40
41             // update this to the path to the "vendor/" directory, relative to this file
42             require_once __DIR__.'/../vendor/autoload.php';
43
44             use PhpXmlRpc\Value;
45             use PhpXmlRpc\Request;
46             use PhpXmlRpc\Client;
47
48             $client = new Client('http://some/server');
49             $response = $client->send(new Request('method', array(new Value('parameter'))));
50
51     5.  IMPORTANT! Make sure that the vendor/phpxmlrpc directory is not directly accessible from the internet,
52         as leaving it open to access means that any visitor can trigger execution of php code such as
53         the built-in debugger.
54
55
56 2.  Via manual download and autoload configuration
57
58     1.  copy the contents of the src/ folder to any location required by your
59         application (it can be inside the web server root or not).
60
61     2.  configure your app autoloading mechanism so that all classes in the PhpXmlRpc namespace are loaded
62         from that location: any PSR-4 compliant autoloader can do that, if you don't have any there is one
63         available in src/Autoloader.php
64
65     3.  Write your code.
66
67             // File example: script.php
68
69             require_once __DIR__.'my_autoloader.php';
70
71             use PhpXmlRpc\Value;
72             use PhpXmlRpc\Request;
73             use PhpXmlRpc\Client;
74
75             $client = new Client('http://some/server');
76             $response = $client->send(new Request('method', array(new Value('parameter'))));
77
78     5.  IMPORTANT! Make sure that the vendor/phpxmlrpc directory is not directly accessible from the internet,
79         as leaving it open to access means that any visitor can trigger execution of php code such as
80         the built-in debugger.
81
82
83 Please note that usage of the 'make' command for installation of the library is
84 not recommended, as it will generally involve editing of the makefile for a
85 successful run.