{"id":19196963,"url":"https://github.com/jitesoft/php-xml2array","last_synced_at":"2026-04-21T13:01:16.268Z","repository":{"id":56999471,"uuid":"83788132","full_name":"jitesoft/php-xml2array","owner":"jitesoft","description":"Simple xml parser for php.","archived":false,"fork":false,"pushed_at":"2017-09-14T10:29:21.000Z","size":33,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-10T19:45:17.391Z","etag":null,"topics":["parser","php7","xml","xml-parser"],"latest_commit_sha":null,"homepage":"","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/jitesoft.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-03-03T10:44:24.000Z","updated_at":"2022-02-12T12:47:58.000Z","dependencies_parsed_at":"2022-08-21T13:51:00.753Z","dependency_job_id":null,"html_url":"https://github.com/jitesoft/php-xml2array","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jitesoft/php-xml2array","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-xml2array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-xml2array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-xml2array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-xml2array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jitesoft","download_url":"https://codeload.github.com/jitesoft/php-xml2array/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jitesoft%2Fphp-xml2array/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32093156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["parser","php7","xml","xml-parser"],"created_at":"2024-11-09T12:15:01.167Z","updated_at":"2026-04-21T13:01:16.192Z","avatar_url":"https://github.com/jitesoft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://img.shields.io/travis/jitesoft/php-xml2array/master.svg?label=master)](https://travis-ci.org/jitesoft/php-xml2array)  \n\n[![Build Status](https://img.shields.io/travis/jitesoft/php-xml2array/develop.svg?label=develop)](https://travis-ci.org/jitesoft/php-xml2array)\n\n[![Dependency Status](https://gemnasium.com/badges/github.com/jitesoft/php-xml2array.svg)](https://gemnasium.com/github.com/jitesoft/php-xml2array)\n\n# XML2Struct\n\nXML can be a pain... Sometimes its a lot more handy to work with a tree structure or even json or an array!  \nThis package was created to ease testing with xml files, so that, instead of going through\na lengthy `DOMElement` test case or even just string-matching the xml right away, one could convert the xml\ninto a more easily handled structure.  \nThus XML2Struct was born.\n\n## Usage:\n\nInstall package through composer:\n\n```\ncomposer require jitesoft/xml2struct\n```\n\nThe parser is quite simple to use, all that is needed is to create a new parser object and\ncall its parse method supplying the xml you want parsed as a string:\n\n```php\n$parser = new Jitesoft\\XML\\Parser();\n// Node tree!\n$out    = $parser-\u003eparse(file_get_contents('myxmlfile.xml'));\n// Json string!\n$json   = json_encode($out);\n// Array!\n$array  = $out-\u003etoArray();\n```\n\n*For more in-depth examples, check the `examples` folder.*  \n\nThe object returned is a `Jitesoft\\XML\\Node` structure.  \nThe structure have the following fields defined:\n\n```\nname:       string                  default: \"\"\ncontent:    string                  default: \"\"\nattributes: array ([key =\u003e value])  default: []\nchildren:   array ([Node])          default: []\n```\n\nWhen converting a node to an array or a json string, the properties or keys will be named the same as \nthe Nodes fields.\nThe keys will always be there, even if there is no value from the xml, if no parsed value, it will be the default value stated above..  \n\n## Changes\n\n### 2.0\n\n* Removed `OutType` on parsing. Instead use `Node::toArray` and `json_encode($node)`.\n* Removed `Node::toString` override. Dump as json if wanted as json.\n\n## Issues and PR's.\n\nAny issues found should be reported in this repository issue tracker, issues will be fixed when possible.  \nPull requests will be accepted, but please try to follow the general code-style! \n\n## License\n\n```text\nMIT License\n\nCopyright (c) 2017 Jitesoft\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitesoft%2Fphp-xml2array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjitesoft%2Fphp-xml2array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjitesoft%2Fphp-xml2array/lists"}