2017 © Pedro Peláez
 

library xmlrpc

Yet another php xmlrpc decoder/encoder

image

comodojo/xmlrpc

Yet another php xmlrpc decoder/encoder

  • Tuesday, July 3, 2018
  • by comodojo
  • Repository
  • 3 Watchers
  • 3 Stars
  • 23,278 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 7 Versions
  • 10 % Grown

The README.md

comodojo/xmlrpc

build Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality Code Coverage Quality Gate Status Reliability Rating, (*1)

Yet another php xmlrpc decoder/encoder., (*2)

This is the development branch, please do not use it in production, (*3)

Main features:, (*4)

  • support for nil and ex:nil
  • implements true, XML compliant, HTML numeric entities conversion
  • support for CDATA values

Installation

  • Using Composer, (*5)

    Install composer, then:, (*6)

    composer require comodojo/xmlrpc, (*7)

Encoding

  • Create an encoder instance:, (*8)

    // create an encoder instance
    $encoder = new \Comodojo\Xmlrpc\XmlrpcEncoder();
    
    // (optional) set character encoding
    $encoder->setEncoding("utf-8");
    
    // (optional) use ex:nil instead of nil
    $encoder->useExNil();
    
    // (optional) declare special types in $data
    $encoder->setValueType($data['a_value'], "base64");
    $encoder->setValueType($data['b_value'], "datetime");
    $encoder->setValueType($data['c_value'], "cdata");
    
    // Wrap actions in a try/catch block (see below)
    try {
    
        /* encoder actions */
    
    } catch (\Comodojo\Exception\XmlrpcException $xe) {
    
        /* someting goes wrong during encoding */
    
    } catch (\Exception $e) {
    
        /* generic error */
    
    }
    
    
  • single call:, (*9)

    $call = $encoder->encodeCall("my.method", array("user"=>"john", "pass" => "doe")) ;
    
    
  • multicall:, (*10)

    $multicall = $encoder->encodeMulticall( array (
        "my.method" => array( "user"=>"john", "pass" => "doe" ),
        "another.method" => array( "value"=>"foo", "param" => "doe" ),
    );
    
    

    Alternate syntax (duplicated-methods safe):, (*11)

    $multicall = $encoder->encodeMulticall( array (
        array( "my.method", array( "user"=>"john", "pass" => "doe" ) ),
        array( "another.method", array( "value"=>"foo", "param" => "doe" ) )
    );
    
    
  • single call success response, (*12)

    $response = $encoder->encodeResponse( array("success"=>true) );
    
    
  • single call error response, (*13)

    $error = $encoder->encodeError( 300, "Invalid parameters" );
    
    
  • multicall success/error (faultString and faultCode should be explicitly declared in $data), (*14)

    $values = $encoder->encodeResponse( array(
    
        array("success"=>true),
    
        array("faultCode"=>300, "faultString"=>"Invalid parameters")
    
    );
    
    

Decoding

  • create a decoder instance:, (*15)

    // create a decoder instance
    $decoder = new \Comodojo\Xmlrpc\XmlrpcDecoder();
    
    // Wrap actions in a try/catch block (see below)
    try {
    
        /* decoder actions */
    
    } catch (\Comodojo\Exception\XmlrpcException $xe) {
    
        /* someting goes wrong during decoding */
    
    }
    
    
  • decode single or multicall, (*16)

    $incoming_call = $decoder->decodeCall( $xml_data );
    
    

    In case of single request, method will return an array like:, (*17)

    array (
        0 => "my.method",
        1 =>  array(
            "param_1" => "value_1",
            "param_2" => "value_2",
            ...
        )
    )
    
    

    In case of multicall:, (*18)

    array (
        0 => array (
            0 => "my.method",
            1 =>  array(
                "param_1" => "value_1",
                "param_2" => "value_2",
                ...
            )
        ),
        1 => array (
            0 => "my.otherMethod",
            1 =>  array(
                "param_a" => "value_a",
                "param_b" => "value_b",
                ...
            )
        )
    )
    
    
  • decode response, (*19)

    $returned_data = $decoder->decodeResponse( $xml_response_data );
    
    

Documentation

Contributing

Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details., (*20)

License

comodojo/xmlrpc is released under the MIT License (MIT). Please see License File for more information., (*21)

Copyright (c) 2018 Marco Giovinazzi, (*22)

For more information, visit comodojo.org., (*23)

The Versions

03/07 2018

1.1.x-dev

1.1.9999999.9999999-dev http://comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

MIT

The Requires

 

The Development Requires

encoder decoder xmlrpc comodojo

03/07 2018

dev-master

9999999-dev http://comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

MIT

The Requires

 

The Development Requires

encoder decoder xmlrpc comodojo

21/03 2018

1.1.3

1.1.3.0 http://comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

MIT

The Requires

 

The Development Requires

encoder decoder xmlrpc comodojo

12/02 2018

1.1.2

1.1.2.0 http://comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

MIT

The Requires

 

The Development Requires

encoder decoder xmlrpc comodojo

14/10 2015

1.1.1

1.1.1.0 http://comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

MIT

The Requires

 

The Development Requires

encoder decoder xmlrpc comodojo

06/05 2015

1.1.0

1.1.0.0 http://www.comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

MIT

The Requires

  • php >=5.1.3

 

The Development Requires

encoder decoder xmlrpc comodojo

03/01 2015

1.0.0

1.0.0.0 http://www.comodojo.org

Yet another php xmlrpc decoder/encoder

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.1.3

 

encoder decoder xmlrpc comodojo