Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyperized/xml-validator
A simple PHP XML validator
https://github.com/hyperized/xml-validator
php validator xml
Last synced: 4 months ago
JSON representation
A simple PHP XML validator
- Host: GitHub
- URL: https://github.com/hyperized/xml-validator
- Owner: hyperized
- License: mit
- Created: 2017-05-18T22:05:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-16T11:07:31.000Z (9 months ago)
- Last Synced: 2024-10-12T06:21:32.328Z (4 months ago)
- Topics: php, validator, xml
- Language: PHP
- Size: 330 KB
- Stars: 7
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [hyperized/xml-validator](https://packagist.org/packages/hyperized/xml-validator)
[![Buy us a tree](https://img.shields.io/badge/Treeware-%F0%9F%8C%B3-lightgreen)](https://plant.treeware.earth/hyperized/xml-validator) ![Run tests](https://github.com/hyperized/xml-validator/workflows/Run%20tests/badge.svg) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/hyperized/xml-validator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/hyperized/xml-validator/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/hyperized/xml-validator/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/hyperized/xml-validator/?branch=master) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fxml-validator.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fxml-validator?ref=badge_shield) [![License](https://poser.pugx.org/hyperized/xml-validator/license)](https://packagist.org/packages/hyperized/xml-validator)
A simple PHP XML validator.
## Installation
```shell script
composer require hyperized/xml-validator
```## Usage
```php
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](https://plant.treeware.earth/hyperized/xml-validator)
Read more about Treeware at [treeware.earth](http://treeware.earth)
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fxml-validator.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fxml-validator?ref=badge_large)