https://github.com/hyperized/xml-validator
A simple PHP XML validator
https://github.com/hyperized/xml-validator
php validator xml
Last synced: 3 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-16T11:07:31.000Z (about 1 year ago)
- Last Synced: 2024-10-12T06:21:32.328Z (9 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)
[](https://plant.treeware.earth/hyperized/xml-validator)  [](https://scrutinizer-ci.com/g/hyperized/xml-validator/?branch=master) [](https://scrutinizer-ci.com/g/hyperized/xml-validator/?branch=master) [](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fxml-validator?ref=badge_shield) [](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
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fxml-validator?ref=badge_large)