{"id":15732974,"url":"https://github.com/pastuhov/php-xml2object","last_synced_at":"2026-05-10T16:45:21.030Z","repository":{"id":57036197,"uuid":"99583633","full_name":"pastuhov/php-xml2object","owner":"pastuhov","description":"Converts XML to object","archived":false,"fork":false,"pushed_at":"2017-08-08T06:09:58.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T11:36:42.953Z","etag":null,"topics":["converter","json","object","parser","php","xml"],"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/pastuhov.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-08-07T13:56:58.000Z","updated_at":"2017-08-07T14:57:29.000Z","dependencies_parsed_at":"2022-08-23T20:50:48.499Z","dependency_job_id":null,"html_url":"https://github.com/pastuhov/php-xml2object","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pastuhov%2Fphp-xml2object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pastuhov%2Fphp-xml2object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pastuhov%2Fphp-xml2object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pastuhov%2Fphp-xml2object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pastuhov","download_url":"https://codeload.github.com/pastuhov/php-xml2object/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413229,"owners_count":20773053,"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":["converter","json","object","parser","php","xml"],"created_at":"2024-10-04T00:40:27.925Z","updated_at":"2026-05-10T16:45:16.001Z","avatar_url":"https://github.com/pastuhov.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/pastuhov/php-xml2object.svg)](https://travis-ci.org/pastuhov/php-xml2object)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pastuhov/php-xml2object/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pastuhov/php-xml2object/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/pastuhov/php-xml2object/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/pastuhov/php-xml2object/?branch=master)\n[![Total Downloads](https://poser.pugx.org/pastuhov/php-xml2object/downloads)](https://packagist.org/packages/pastuhov/php-xml2object)\n\nConverts XML to object\n===========================\n\nInput: \n```xml\n\u003croot\u003e\n    \u003cdetail detailid=\"3721899\" formattedoem=\"90311-71001\" manufacturer=\"TOYOTA\"\u003e\n        \u003cproperties\u003e\n            \u003cproperty code=\"Name\" detailpropertyid=\"6086730\" locale=\"en_US\" property=\"Наименование\"/\u003e\n            \u003cproperty property=\"Наименование\" rate=\"5\" value=\"ｶﾑｼｬﾌﾄｾｯﾃｨﾝｸﾞ ｵｲﾙ ｼｰﾙ\"/\u003e\n            \u003cproperty rate=\"5\" value=\"0.035 кг\"/\u003e\n        \u003c/properties\u003e\n    \u003c/detail\u003e\n    \u003cdetail detailid=\"4445210\" formattedoem=\"20621-71001\" manufacturer=\"TOYOTA\"\u003e\n        \u003cproperties\u003e\n            \u003cproperty code=\"Name\" detailpropertyid=\"6086730\" locale=\"en_US\" property=\"Наименование\"/\u003e\n            \u003cproperty property=\"Наименование\" rate=\"5\" value=\"ｶﾑｼｬﾌﾄｾｯﾃｨﾝｸﾞ ｵｲﾙ ｼｰﾙ\"/\u003e\n        \u003c/properties\u003e\n    \u003c/detail\u003e\n\u003c/root\u003e\n```\n\nOutput:\n```javascript\n{\n    \"_tagName\": \"root\",\n    \"_childrenProperty\": \"children\",\n    \"children\": [\n        {\n            \"_tagName\": \"detail\",\n            \"_childrenProperty\": \"properties\",\n            \"detailid\": \"3721899\",\n            \"formattedoem\": \"90311-71001\",\n            \"manufacturer\": \"TOYOTA\",\n            \"properties\": [\n                {\n                    \"_tagName\": \"property\",\n                    \"_childrenProperty\": null,\n                    \"code\": \"Name\",\n                    \"detailpropertyid\": \"6086730\",\n                    \"locale\": \"en_US\",\n                    \"property\": \"Наименование\"\n                },\n                {\n                    \"_tagName\": \"property\",\n                    \"_childrenProperty\": null,\n                    \"property\": \"Наименование\",\n                    \"rate\": \"5\",\n                    \"value\": \"ｶﾑｼｬﾌﾄｾｯﾃｨﾝｸﾞ ｵｲﾙ ｼｰﾙ\"\n                },\n                {\n                    \"_tagName\": \"property\",\n                    \"_childrenProperty\": null,\n                    \"rate\": \"5\",\n                    \"value\": \"0.035 кг\"\n                }\n            ]\n        },\n        {\n            \"_tagName\": \"detail\",\n            \"_childrenProperty\": \"properties\",\n            \"detailid\": \"4445210\",\n            \"formattedoem\": \"20621-71001\",\n            \"manufacturer\": \"TOYOTA\",\n            \"properties\": [\n                {\n                    \"_tagName\": \"property\",\n                    \"_childrenProperty\": null,\n                    \"code\": \"Name\",\n                    \"detailpropertyid\": \"6086730\",\n                    \"locale\": \"en_US\",\n                    \"property\": \"Наименование\"\n                },\n                {\n                    \"_tagName\": \"property\",\n                    \"_childrenProperty\": null,\n                    \"property\": \"Наименование\",\n                    \"rate\": \"5\",\n                    \"value\": \"ｶﾑｼｬﾌﾄｾｯﾃｨﾝｸﾞ ｵｲﾙ ｼｰﾙ\"\n                }\n            ]\n        }\n    ]\n}\n\n```\n\n\n## Features\n\n* converts desired tags to properties\n* fast\n* memory saving\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist pastuhov/php-xml2object\n```\n\nor add\n\n```\n\"require-dev\": {\n    \"pastuhov/php-xml2object\": \"~1.0.0\"\n    ...\n```\n\nto the require section of your `composer.json` file.\n\nUsage\n-----\n\n```php\nuse pastuhov\\xml2object\\Parser;\n\n$converter = new Parser();\n$converter-\u003exml = file_get_contents(__DIR__ . '/data/xml.xml');\n$object = $converter-\u003eprocess();\n```\n\nTesting\n-------\n\n```bash\n./vendor/bin/phpunit\n```\n\nSecurity\n--------\n\nIf you discover any security related issues, please email pastukhov_k@sima-land.ru instead of using the issue tracker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpastuhov%2Fphp-xml2object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpastuhov%2Fphp-xml2object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpastuhov%2Fphp-xml2object/lists"}