2017 © Pedro Peláez
 

library xmlrpcbundle

Simple XML RPC Server for Symfony 2

image

bdunogier/xmlrpcbundle

Simple XML RPC Server for Symfony 2

  • Friday, June 20, 2014
  • by bdunogier
  • Repository
  • 0 Watchers
  • 4 Stars
  • 41 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 2 Forks
  • 4 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

XML RPC Bundle

Build Status Analytics, (*1)

Principle

This Symfony 2 bundle will let you implement an XML-RPC server without leaving the comfort of your gold old Symfony 2., (*2)

It does the following: - intercept requests to the XML-RPC endpoint - convert the XML payload to a unique route (based on the methodCall) - convert the XML payload to a set of primitive parameters (arrays, hashes, integers, strings...), (*3)

Usage example

Let's consider this XML-RPC payload:, (*4)

<methodCall>
  <methodName>myAPI.getLatestContent</methodName>
  <params>
    <param>
      <value>Some string</value>
    </param>
  </params>
</methodCall>

To process this call, all you need to do is create a route that matches /xmlrpc/API.getLatestContent, and map a controller to it, the usual way:, (*5)

myroute.getLatestContent:
  path: /xmlrpc/myAPI.getLatestContent
  defaults:
    _controller: MyBundle:API:getLatestContent

And that's it. In your controller, you will receive a standard HttpFoundation Request, where each parameter is part of the POST data., (*6)

An hello world example can be found inside the bundle itself., (*7)

Parameters providers

By default, the route won't receive any parameter, and parameters from the XML-RPC request will be made available as $_POST[0], $_POST[1], ..., (*8)

In order to get more meaningful controllers, ParametersProcessor can be used., (*9)

A parameter processor must: - implement BD\Bundle\XmlRpcBundle\XmlRpc\ParametersProcessorInterface - be registered as a service tagged as bdxmlrpc.parameters_processor, with a methodName attribute matching the XML-RPC method, (*10)

The interface requires two methods: getRoutePathArguments and getParameters. Both will refine the request arguments based on the contents of the $parameters array, a numerical array of the XML-RPC request parameters., (*11)

ParametersProcessorInterface::getRoutePathArgument()

Returns route URI arguments, as a numerically indexed array. Each argument will be added to the route's path, separated by slashes., (*12)

ParametersProcessorInterface::getParameters()

This method must return an array, associative or not, of POST parameters that will be added to the request., (*13)

Bitdeli Badge, (*14)

The Versions

12/07 2013

1.0.0

1.0.0.0

Simple XML RPC Server for Symfony 2

  Sources   Download

GPL-2.0

10/07 2013

0.1.0

0.1.0.0

Simple XML RPC Server for Symfony 2

  Sources   Download

GPL-2.0