hyperized/xml-validator
最新稳定版本:1.4.1
Composer 安装命令:
composer require hyperized/xml-validator
包简介
A simple PHP XML validator
关键字:
README 文档
README
A simple PHP XML validator.
Installation
composer require hyperized/xml-validator
Usage
<?php namespace Hyperized\Xml; require __DIR__ . '/vendor/autoload.php'; $xmlString = file_get_contents(__DIR__ . '/tests/files/correct.xml'); $dirtyXMLString = file_get_contents(__DIR__ . '/tests/files/incorrect.xml'); $xmlFile = __DIR__ . '/tests/files/correct.xml'; $xsdFile = __DIR__ . '/tests/files/simple.xsd'; $validator = new Validator(); // String validation print_r($validator->isXMLStringValid($xmlString)); // 1 print_r($validator->isXMLStringValid($xmlString, $xsdFile)); // 1 // File validation print_r($validator->isXMLFileValid($xmlFile)); // 1 print_r($validator->isXMLFileValid($xmlFile, $xsdFile)); // 1 // Error handling try { $validator->isXMLStringValid($dirtyXMLString, $xsdFile); } catch (Exceptions\InvalidXmlException $exception) { print_r($exception->getMessage()); // xmlParseEntityRef: no name\n The document has no document element. }
Treeware
You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.
It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
You can buy trees here offset.earth/treeware
Read more about Treeware at treeware.earth
License
统计信息
- 总下载量: 2.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-18