ordinary9843/xml-master 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ordinary9843/xml-master

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ordinary9843/xml-master

包简介

Convert array to XML format

README 文档

README

build codecov

Intro

Convert array to XML format.

Requirements

This library has the following requirements:

  • PHP 7.1+

Installation

Require the package via composer:

composer require ordinary9843/xml-master

Usage

Example usage:

<?php
require './vendor/autoload.php';

use Ordinary9843\XmlMaster;

$xmlMaster = new XmlMaster();

// Set XML version.
$xmlMaster->setVersion('1.0');

// Set XML encoding type.
$xmlMaster->setEncoding('UTF-8');

/**
 * Array conversion to XML.
 *
 * Output:
 *
 * <root>
 *   <user>
 *     <name>Software Engineer</name>
 *     <email>ordinary9843@gmail.com</email>
 *     <title>Sortware Engineer</title>
 *     <website>https://github.com/ordinary9843</website>
 *   </user>
 * </root>
 */
$xmlMaster->convert([
    'user' => [
        'name' => 'Software Engineer',
        'email' => 'ordinary9843@gmail.com',
        'title' => 'Sortware Engineer',
        'website' => 'https://github.com/ordinary9843'
    ]
]);

/**
 * Convert array to XML and save the result.
 */
$xmlMaster->save('./test.xml', [
    'user' => [
        'name' => 'Software Engineer',
        'email' => 'ordinary9843@gmail.com',
        'title' => 'Sortware Engineer',
        'website' => 'https://github.com/ordinary9843'
    ]
]);

/**
 * Get all messages.
 *
 * Output: [
 *  '[INFO] Message.',
 *  '[ERROR] Message.'
 * ]
 */
$xmlMaster->getMessages();

Testing

composer test

Licenses

(The MIT License)

统计信息

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

GitHub 信息

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

其他信息

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