comodojo/xmlrpc
最新稳定版本:2.0.1
Composer 安装命令:
composer require comodojo/xmlrpc
包简介
Yet another php xmlrpc decoder/encoder
README 文档
README
Yet another php xmlrpc decoder/encoder.
This is the development branch, please do not use it in production
Main features:
- support for
nilandex:nil - implements true, XML compliant, HTML numeric entities conversion
- support for CDATA values
Installation
-
Using Composer
Install composer, then:
composer require comodojo/xmlrpc
Encoding
-
Create an encoder instance:
// 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:
$call = $encoder->encodeCall("my.method", array("user"=>"john", "pass" => "doe")) ;
-
multicall:
$multicall = $encoder->encodeMulticall( array ( "my.method" => array( "user"=>"john", "pass" => "doe" ), "another.method" => array( "value"=>"foo", "param" => "doe" ), );
Alternate syntax (duplicated-methods safe):
$multicall = $encoder->encodeMulticall( array ( array( "my.method", array( "user"=>"john", "pass" => "doe" ) ), array( "another.method", array( "value"=>"foo", "param" => "doe" ) ) );
-
single call success response
$response = $encoder->encodeResponse( array("success"=>true) );
-
single call error response
$error = $encoder->encodeError( 300, "Invalid parameters" );
-
multicall success/error (faultString and faultCode should be explicitly declared in $data)
$values = $encoder->encodeResponse( array( array("success"=>true), array("faultCode"=>300, "faultString"=>"Invalid parameters") );
Decoding
-
create a decoder instance:
// 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
$incoming_call = $decoder->decodeCall( $xml_data );
In case of single request, method will return an array like:
array ( 0 => "my.method", 1 => array( "param_1" => "value_1", "param_2" => "value_2", ... ) )
In case of multicall:
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
$returned_data = $decoder->decodeResponse( $xml_response_data );
Documentation
Contributing
Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details.
License
comodojo/xmlrpc is released under the MIT License (MIT). Please see License File for more information.
Copyright (c) 2018 Marco Giovinazzi
For more information, visit comodojo.org.
comodojo/xmlrpc 适用场景与选型建议
comodojo/xmlrpc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 121.19k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 10 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「encoder」 「xmlrpc」 「decoder」 「comodojo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 comodojo/xmlrpc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 comodojo/xmlrpc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 comodojo/xmlrpc 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A collection of server-side addons that might be of use for development of xml-rpc (and json-rpc) based applications
package of the library classes to provide XmlRpc routines for accessing revive ad servers
Streaming parser to extract tarballs with ReactPHP.
base62 encoder and decoder also for big numbers with Laravel integration
PHP Library for Encoding.com's XML API
A Base91 implementation as a composer package
统计信息
- 总下载量: 121.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-10-16