{"id":15025018,"url":"https://github.com/mtownsend5512/xml-to-array","last_synced_at":"2025-04-05T22:09:16.175Z","repository":{"id":47816641,"uuid":"153471629","full_name":"mtownsend5512/xml-to-array","owner":"mtownsend5512","description":"Easily convert valid xml to a php array.","archived":false,"fork":false,"pushed_at":"2021-02-27T22:39:59.000Z","size":6,"stargazers_count":114,"open_issues_count":3,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T21:08:14.388Z","etag":null,"topics":["api","array","convert","xml","xml-files","xml-parser","xml-to-array"],"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/mtownsend5512.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-17T14:32:03.000Z","updated_at":"2025-03-02T17:29:59.000Z","dependencies_parsed_at":"2022-09-21T11:11:41.272Z","dependency_job_id":null,"html_url":"https://github.com/mtownsend5512/xml-to-array","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtownsend5512%2Fxml-to-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtownsend5512%2Fxml-to-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtownsend5512%2Fxml-to-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtownsend5512%2Fxml-to-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtownsend5512","download_url":"https://codeload.github.com/mtownsend5512/xml-to-array/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406091,"owners_count":20933803,"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":["api","array","convert","xml","xml-files","xml-parser","xml-to-array"],"created_at":"2024-09-24T20:01:24.673Z","updated_at":"2025-04-05T22:09:16.158Z","avatar_url":"https://github.com/mtownsend5512.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Easily convert valid xml to a php array.\n\n## Installation\n\nInstall via composer:\n\n```\ncomposer require mtownsend/xml-to-array\n```\n\n## Quick start\n\n### Using the class\n\n```php\nuse Mtownsend\\XmlToArray\\XmlToArray;\n\n$xml = \u003c\u003c\u003cXML\n\u003c?xml version=\"1.0\"?\u003e\n\u003crequest\u003e\n    \u003ccarrier\u003efedex\u003c/carrier\u003e\n    \u003cid\u003e123\u003c/id\u003e\n    \u003ctracking_number\u003e9205590164917312751089\u003c/tracking_number\u003e\n\u003c/request\u003e\nXML;\n\n$array = XmlToArray::convert($xml);\n\n// $array is:\n[\n\t'carrier' =\u003e 'fedex',\n\t'id' =\u003e '123',\n\t'tracking_number' =\u003e '9205590164917312751089'\n];\n\n```\n\n### Using the global helper\n\n```php\n$xml = \u003c\u003c\u003cXML\n\u003c?xml version=\"1.0\"?\u003e\n\u003crequest\u003e\n    \u003ccarrier\u003efedex\u003c/carrier\u003e\n    \u003cid\u003e123\u003c/id\u003e\n    \u003ctracking_number\u003e9205590164917312751089\u003c/tracking_number\u003e\n\u003c/request\u003e\nXML;\n\n$array = xml_to_array($xml);\n\n// $array is:\n[\n\t'carrier' =\u003e 'fedex',\n\t'id' =\u003e '123',\n\t'tracking_number' =\u003e '9205590164917312751089'\n];\n```\n\n## Helpers, methods, and arguments\n\n**Static method**\n\n``XmlToArray::convert($xml, $outputRoot = false)``\n\nThe ``$outputRoot`` determines whether or not the php array will have a ``@root`` key. Default is ``false``.\n\n**Helper**\n\n``xml_to_array($xml, $outputRoot = false)``\n\nArguments are identical to ``XmlToArray::convert`` method.\n\n## Purpose\n\nXML has always been a challenge to work with in PHP compared to other data formats, such as JSON. This package aims to make integrating with XML files or api requests significantly easier. With this package, you might actually like interfacing with XML in your application now.\n\n## Other packages you may be interested in\n\n- [mtownsend/collection-xml](https://github.com/mtownsend5512/collection-xml)\n- [mtownsend/request-xml](https://github.com/mtownsend5512/request-xml)\n- [mtownsend/response-xml](https://github.com/mtownsend5512/response-xml)\n\n## Credits\n\n- Mark Townsend\n- Adrien aka Gaarf\n- [All Contributors](../../contributors)\n\n## Testing\n\nYou can run the tests with:\n\n```bash\n./vendor/bin/phpunit\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtownsend5512%2Fxml-to-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtownsend5512%2Fxml-to-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtownsend5512%2Fxml-to-array/lists"}