Improve documentation for v4; fix one typo in a comment
authorgggeek <giunta.gaetano@gmail.com>
Sat, 21 Feb 2015 20:27:57 +0000 (20:27 +0000)
committergggeek <giunta.gaetano@gmail.com>
Sat, 21 Feb 2015 20:27:57 +0000 (20:27 +0000)
INSTALL
NEWS
src/Client.php

diff --git a/INSTALL b/INSTALL
index b5eeddf..b016c13 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -3,8 +3,8 @@ XMLRPC for PHP
 Requirements
 ------------
 
-The following requirements should be met prior to using 'XMLRPC for PHP': 
-. PHP 5.1.0 or later
+The following requirements should be met prior to using 'XMLRPC for PHP':
+. PHP 5.3.0 or later
 . the php "curl" extension is needed if you wish to use SSL or HTTP 1.1 to
   communicate with remote servers
 
@@ -17,22 +17,66 @@ Installation instructions
 
 Installation of the library is quite easy:
 
-1. copy the contents of the lib/ folder to any location required by your
-   application (it can be inside the web server root or not).
+1. Via Composer (highly recommended):
 
-2. make sure your app can include those files. This can be achieved by setting
-   the PHP include path, either in the php.ini file or directly in the php code
-   of your application, using the 'set_include_path' function
+    1. Install composer if you don't have it already present on your system.
+        Depending on how you install, you may end up with a composer.phar file in your directory.
+        In that case, no worries! Just substitute 'php composer.phar' for 'composer' in the commands below.
 
+    2. If you're creating a new project, create a new empty directory for it.
 
-Example of php code allowing an application to import the library:
+    3. Open a terminal and use Composer to grab the library.
 
-set_include_path(get_include_path() . PATH_SEPARATOR . '/path/to/phpxmlrpc/lib/');
-require_once( 'xmlrpc.inc' );
-require_once( 'xmlrpcs.inc' );
-require_once( 'xmlrpc_wrappers.inc' );
+            $ composer require phpxmlrpc/phpxmlrpc:4.0
+
+    4. Write your code.
+        Once Composer has downloaded the component(s), all you need to do is include the vendor/autoload.php file that
+        was generated by Composer. This file takes care of autoloading all of the libraries so that you can use them
+        immediately, including phpxmlrpc:
+
+            // File example: src/script.php
+
+            // update this to the path to the "vendor/" directory, relative to this file
+            require_once __DIR__.'/../vendor/autoload.php';
+
+            use PhpXmlRpc\Value;
+            use PhpXmlRpc\Request;
+            use PhpXmlRpc\Client;
+
+            $client = new Client('http://some/server');
+            $response = $client->send(new Request('method', array(new Value('parameter'))));
+
+    5. IMPORTANT! Make sure that the vendor/phpxmlrpc directory is not directly accessible from the internet,
+        as leaving it open to access means that any visitor can trigger execution of php code such as
+        the built-in debugger.
+
+
+2. Via manual download and autoload configuration
+
+    1. copy the contents of the src/ folder to any location required by your
+        application (it can be inside the web server root or not).
+
+    2. configure your app autoloading mechanism so that all classes in the PhpXmlRpc namespace are loaded
+        from that location (any PSR-4 compliant autoloader can do that)
+
+    3. Write your code.
+
+            // File example: script.php
+
+            require_once __DIR__.'my_autoloader.php';
+
+            use PhpXmlRpc\Value;
+            use PhpXmlRpc\Request;
+            use PhpXmlRpc\Client;
+
+            $client = new Client('http://some/server');
+            $response = $client->send(new Request('method', array(new Value('parameter'))));
+
+    5. IMPORTANT! Make sure that the vendor/phpxmlrpc directory is not directly accessible from the internet,
+        as leaving it open to access means that any visitor can trigger execution of php code such as
+        the built-in debugger.
 
 
 Please note that usage of the 'make' command for installation of the library is
 not recommended, as it will generally involve editing of the makefile for a
-succesfull run.
+successful run.
diff --git a/NEWS b/NEWS
index 62b43ee..f3cb530 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,14 +7,23 @@ but some breackage is to be expected.
 
 PLEASE READ CAREFULLY THE NOTES BELOW to insure a smooth upgrade.
 
-The minimum requied php version has been increase to 5.3,
-even though we stronly urge you to use more recent versions.
+The minimum required php version has been increased to 5.3,
+even though we strongly urge you to use more recent versions.
+
+* new: introduction of namespaces.
+
+  All php classes have been renamed and moved to separate files.
+  Class autoloading can now be done in accord with the PSR-4 standard.
+  Backward compatibility is maintained via lib/xmlrpc.inc, lib/xmlrpcs.inc and lib/xmlrpc_wrappers.inc.
+
+* improved: all php code is now formatted according to the PSR-2 standard
 
 * improved: this release is now tested using Travis ( https://travis-ci.org/ ).
 
-* improved: no need to call anymore $client->setSSLVerifyHost(2) to silence a curl warning when using https with recent curl builds
+* improved: no need to call anymore $client->setSSLVerifyHost(2) to silence a curl warning when using https
+  with recent curl builds
 
-* improved: phpunit is now installed via composer, not bundled anymore 
+* improved: phpunit is now installed via composer, not bundled anymore
 
 
 XML-RPC for PHP version 3.0.0 - 2014/6/15
@@ -164,7 +173,7 @@ CHANGELOG IN DETAIL:
 * documentation for single parameters of exposed methods can be added to the dispatch map
   (and turned into html docs in conjunction with a future release of the extras package)
 * full response payload is saved into xmlrpcresp object for further debugging
-* stricter parsing of incmoing xmlrpc messages: two more invalid cases are now detected
+* stricter parsing of incoming xmlrpc messages: two more invalid cases are now detected
   (double data element inside array and struct/array after scalar inside value element)
 * debugger can now generate code that wraps a remote method into php function (works for jsonrpc, too)
 * debugger has better support for being activated via a single GET call (for integration into other tools?)
@@ -259,7 +268,7 @@ HTTPS support:
    $xmlrpc_internalencoding was set to UTF-8
  * fixed bug in xmlrpc_server::echoInput() (and marked method as deprecated)
  * correctly set cookies/http headers into xmlrpcresp objects even when the
-   sned() method call fails for some reason
+   send() method call fails for some reason
  * added a benchmark file in the testsuite directory
 
 A couple of (private/protected) methods have been refactored, as well as a
@@ -336,9 +345,9 @@ This is a bugfix and maintenance release. No major new features have been added.
 All known bugs have been ironed out, unless fixing would have meant breaking
 the API.
 The code has been tested with PHP 3, 4 and 5, even tough PHP 4 is the main
-development platform (and some warnings will be emitted when runnning PHP5).
+development platform (and some warnings will be emitted when running PHP5).
 
-Notheworthy changes include:
+Noteworthy changes include:
 
  * do not clash any more with the EPI xmlrpc extension bundled with PHP 4 and 5
  * fixed the unicode/charset problems that have been plaguing the lib for years
index a5c6477..57410a8 100644 (file)
@@ -324,7 +324,7 @@ class Client
      */
     public function & send($msg, $timeout = 0, $method = '')
     {
-        // if user deos not specify http protocol, use native method of this client
+        // if user does not specify http protocol, use native method of this client
         // (i.e. method set during call to constructor)
         if ($method == '') {
             $method = $this->method;