承接 jtrumbull/xml-parser 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jtrumbull/xml-parser

Composer 安装命令:

composer require jtrumbull/xml-parser

包简介

PHP Class that parses XML objects

README 文档

README

I needed a quick way of outputting XML from an associative array on a few projects -this was the end result. I created this repository for later reference and fellow devs. At the time, It served it's purpose, however I am not actively developing this project -see the Contributing section.

Table of contents

Installation

  • composer require jtrumbull/xml-parser

##Usage

header('Content-type: text/xml');

use XMLParser\XMLParser;

$data = array(
  'attr:status'=>'success',
  'Person'=>array(
    'attr:id'=>987654321,
    'First Name'=>'John',
    'Last Name'=>'Smith'
  ),
  'Address'=>array(
    'attr:'=>array(
      'geo-coded'=>TRUE,
      'lat'=>'0.0000',
      'lon'=>'-0.0000'
    ),
    'Street'=>'123 Main Street',
    'City'=>'Somewhere',
    'State'=>'DE',
    'Zip'=>'12345'
  ),
  'other'=>array(
    'key'=>'value',
    array('value1','value2','value3')
  )
);

$xml = XMLParser::encode( $data , 'response' );
echo $xml->asXML();

Will output:

<response status="success">
  <person id="987654321">
    <first_name>John</first_name>
    <last_name>Smith</last_name>
  </person>
  <address geo-coded="TRUE" lat="0.0000" lon="-0.0000">
    <street>123 Main Street</street>
    <city>Somewhere</city>
    <state>DE</state>
    <zip>12345</zip>
  </address>
  <other>
    <key>value</key>
    <list>
      <item>value1</item>
      <item>value2</item>
      <item>value3</item>
    </list>
  </other>
</response>

Documentation

XMLParser\XMLParser::encode()

Syntax:

SimpleXMLElement XMLParser::encode( mixed $data [, string $root] )

Returns: SimpleXMLElement

XMLParser\XMLParser::decode()

Syntax:

json XMLParser::decode( mixed $string )

Returns: json

Contributing

Check out the issue tracker, if your issue or feature request has not addressed open a new issue. All pull requests are welcome.

Community

Copyright and license

XML parser is distributed under the MIT License -see LICENSE.md

jtrumbull/xml-parser 适用场景与选型建议

jtrumbull/xml-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 52.25k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2015 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jtrumbull/xml-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jtrumbull/xml-parser 我们能提供哪些服务?
定制开发 / 二次开发

基于 jtrumbull/xml-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 52.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 7
  • 依赖项目数: 2
  • 推荐数: 1

GitHub 信息

  • Stars: 18
  • Watchers: 2
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-04