定制 sammyjo20/xml-to-array 二次开发

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

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

sammyjo20/xml-to-array

最新稳定版本:v1.0.0

Composer 安装命令:

composer require sammyjo20/xml-to-array

包简介

Convert an XML string into an easy to understand array

README 文档

README

Build Status

This package provides an easy way to convert an XML string into an array.

Inspired by Spatie's array-to-xml.

Install

You can install this package with Composer.

composer require sammyjo20/xml-to-array

Usage

<?php

use Sammyjo20\XmlToArray\XmlToArray;

$xml = '<items>
    <good_guy>
        <name>Luke Skywalker</name>
        <weapon>Lightsaber</weapon>
    </good_guy>
    <bad_guy>
        <name>Sauron</name>
        <weapon>Evil Eye</weapon>
    </bad_guy>
</items>';

$result = XmlToArray::convert($xml);

Result

array:1 [
  "items" => array:2 [
    "good_guy" => array:2 [
      "name" => "Luke Skywalker"
      "weapon" => "Lightsaber"
    ]
    "bad_guy" => array:2 [
      "name" => "Sauron"
      "weapon" => "Evil Eye"
    ]
  ]
]

Thank you to the original creator

This package was originally created by vyuldashev. This package is an up-to-date version with some bugs fixed. Click here to view the original package.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-04