定制 alextartan/xml2array 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

alextartan/xml2array

最新稳定版本:2.0.2

Composer 安装命令:

composer require alextartan/xml2array

包简介

Lightweight xml<->array conversion.

README 文档

README

Array <-> XML conversion package

Lightweight XML parser

Current build status

Build Status codecov Infection MSI Dependabot Status Downloads

Install

The easiest way is to use composer:

composer require alextartan/xml2array 

Notes:

Latest release requires PHP >= 7.2 and the dom extension (ext-dom)

For PHP <= 7.2, use version 1.0.2

Usage

ArrayToXml

Convert an XML (either DOMDocument or string) to an array

// default value: $config = [ 'version' => '1.0', 'encoding' => 'UTF-8', 'attributesKey' => '@attributes', 'cdataKey' => '@cdata', 'valueKey' => '@value', 'useNamespaces' => false, 'forceOneElementArray => false, ]; $xtoa = new XmlToArray($config); $array = $xtoa->buildArrayFromString($xmlString); $array = $xtoa->buildArrayFromDomDocument($xmlDom); 
XmlToArray

Convert an array to a DOMDocument

// default value: $config = [ 'version' => '1.0', 'encoding' => 'UTF-8', 'attributesKey' => '@attributes', 'cdataKey' => '@cdata', 'valueKey' => '@value', 'formatOutput' => false, ]; $atox = new ArrayToXml($config); $xml = $atox->buildXml($array); 

Issues and pull requests.

Any issues found should be reported in this repository issue tracker, issues will be fixed when possible. Pull requests will be accepted, but please adhere to the PSR2 coding standard. All builds must pass in order to merge the PR.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-01-04