fix php 5.6 in docker dev env (#1740)
[openemr.git] / vendor / zendframework / zend-xmlrpc / doc / book / intro.md
blobf27e5ee77bd7dc4dad58e8982bb4a3b74371b006
1 # Introduction
3 From its [home page](http://www.xmlrpc.com/), XML-RPC is described as:
5 > "...remote procedure calling using HTTP as the transport and XML as the
6 > encoding. XML-RPC is designed to be as simple as possible, while allowing
7 > complex data structures to be transmitted, processed and returned."
9 zend-xmlrpc provides support for both consuming remote XML-RPC services and
10 providing XML-RPC servers.
12 ## Quick Start
14 The following demonstrates the most basic use case for `Zend\XmlRpc\Server`:
16 ```php
17 class Greeter
19     /**
20     * Say hello to someone.
21     *
22     * @param string $name Who to greet
23     * @return string
24     */
25     public function sayHello($name = 'Stranger')
26     {
27         return sprintf("Hello %s!", $name);
28     }
31 $server = new Zend\XmlRpc\Server;
33 // Our Greeter class will be called "greeter" from the client:
34 $server->setClass('Greeter', 'greeter');
35 $server->handle();
36 ```
38 > ### Docblock annotations are required
40 > Function and method docblocks containing parameter and return value
41 > annotations **are required** when exposing them via `Zend\XmlRpc\Server`. The
42 > values will be used to validate method parameters and provide method
43 > signatures to clients.
45 > Docblock descriptions will also be used to provide method help text.
47 The following demonstrates an XML-RPC client that can consume the above service:
49 ```php
50 $client = new Zend\XmlRpc\Client('http://example.com/xmlrpcserver.php');
52 echo $client->call('greeter.sayHello');
53 // will output "Hello Stranger!"
55 echo $client->call('greeter.sayHello', ['Dude']);
56 // will output "Hello Dude!"
57 ```