{"id":16409799,"url":"https://github.com/hyperized/xml-validator","last_synced_at":"2025-03-21T03:31:20.662Z","repository":{"id":21073552,"uuid":"91741556","full_name":"hyperized/xml-validator","owner":"hyperized","description":"A simple PHP XML validator","archived":false,"fork":false,"pushed_at":"2024-05-16T11:07:31.000Z","size":338,"stargazers_count":7,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T06:21:32.328Z","etag":null,"topics":["php","validator","xml"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperized.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-18T22:05:50.000Z","updated_at":"2023-05-12T11:20:11.000Z","dependencies_parsed_at":"2022-07-23T08:16:28.071Z","dependency_job_id":null,"html_url":"https://github.com/hyperized/xml-validator","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fxml-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fxml-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fxml-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fxml-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperized","download_url":"https://codeload.github.com/hyperized/xml-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811376,"owners_count":16884305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","validator","xml"],"created_at":"2024-10-11T06:21:31.908Z","updated_at":"2024-10-28T09:14:14.445Z","avatar_url":"https://github.com/hyperized.png","language":"PHP","readme":"# [hyperized/xml-validator](https://packagist.org/packages/hyperized/xml-validator)\n\n[![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)\n\nA simple PHP XML validator.\n\n## Installation\n\n```shell script\ncomposer require hyperized/xml-validator\n```\n\n## Usage\n\n```php\n\u003c?php\n\nnamespace Hyperized\\Xml;\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$xmlString = file_get_contents(__DIR__ . '/tests/files/correct.xml');\n$dirtyXMLString = file_get_contents(__DIR__ . '/tests/files/incorrect.xml');\n$xmlFile = __DIR__ . '/tests/files/correct.xml';\n$xsdFile = __DIR__ . '/tests/files/simple.xsd';\n\n$validator = new Validator();\n\n// String validation\nprint_r($validator-\u003eisXMLStringValid($xmlString)); // 1\nprint_r($validator-\u003eisXMLStringValid($xmlString, $xsdFile)); // 1\n\n// File validation\nprint_r($validator-\u003eisXMLFileValid($xmlFile)); // 1\nprint_r($validator-\u003eisXMLFileValid($xmlFile, $xsdFile)); // 1\n\n// Error handling\ntry {\n    $validator-\u003eisXMLStringValid($dirtyXMLString, $xsdFile);\n} catch (Exceptions\\InvalidXmlException $exception)\n{\n    print_r($exception-\u003egetMessage()); //  xmlParseEntityRef: no name\\n The document has no document element.\n}\n```\n\n## Treeware\n\nYou're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.\n\nIt’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 \u003ca href=\"https://www.bbc.co.uk/news/science-environment-48870920\"\u003eplant trees\u003c/a\u003e. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.\n\nYou can buy trees here [offset.earth/treeware](https://plant.treeware.earth/hyperized/xml-validator)\n\nRead more about Treeware at [treeware.earth](http://treeware.earth)\n\n## License\n[![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)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperized%2Fxml-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperized%2Fxml-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperized%2Fxml-validator/lists"}