承接 byjg/xmlutil 相关项目开发

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

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

byjg/xmlutil

最新稳定版本:6.0.0

Composer 安装命令:

composer require byjg/xmlutil

包简介

A powerful and intuitive PHP library for working with XML documents. This utility makes XML manipulation, querying, and conversion simple and straightforward in PHP.

README 文档

README

A powerful and intuitive PHP library for working with XML documents. This utility makes XML manipulation, querying, and conversion simple and straightforward in PHP.

Sponsor Build Status Opensource ByJG GitHub source GitHub license GitHub release

Overview

PHP XML Util provides a comprehensive set of tools for XML manipulation in PHP applications. It simplifies common XML operations with an intuitive API, allowing developers to create, modify, query, and validate XML documents with minimal code.

The library is designed to be lightweight yet powerful, offering features that go beyond PHP's built-in XML functionality while maintaining a clean and easy-to-use interface.

Key Features

  • Simple XML Creation API - Create and manipulate XML documents programmatically with an intuitive API
  • XPath Querying - Easily query and navigate XML documents using XPath expressions
  • PHP Model ↔ XML Conversion - Seamlessly convert between PHP objects and XML representations
  • Attribute-Based Mapping - Use PHP attributes to control XML serialization behavior
  • Namespace Support - Full support for XML namespaces in all operations
  • Document Cleaning - Selectively remove specific tags from XML documents
  • XML Validation - Validate XML documents against schemas
  • File Handling - Convenient methods for loading and saving XML from/to files

Quick Example

<?php
use ByJG\XmlUtil\XmlDocument;

// Create a new XML document
$xml = new XmlDocument('<root />');

// Build the document structure
$myNode = $xml->appendChild('mynode');
$myNode->appendChild('subnode', 'text');
$myNode->appendChild('subnode', 'more text');
$otherNode = $myNode->appendChild('othersubnode', 'other text');
$otherNode->addAttribute('attr', 'value');

// Output formatted XML
echo $xml->toString(format: true);

Output:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <mynode>
    <subnode>text</subnode>
    <subnode>more text</subnode>
    <othersubnode attr="value">other text</othersubnode>
  </mynode>
</root>

Documentation

The library is fully documented with detailed guides and examples for each feature:

Installation

composer require "byjg/xmlutil"

Running Tests

vendor/bin/phpunit

License

MIT

Dependencies

flowchart TD
    byjg/xmlutil --> ext-simplexml
    byjg/xmlutil --> ext-dom
    byjg/xmlutil --> byjg/serializer
Loading

Open source ByJG

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-22