{"id":17358683,"url":"https://github.com/phpjunior/laravel-xml","last_synced_at":"2025-04-15T00:11:03.534Z","repository":{"id":257827216,"uuid":"872980643","full_name":"PHPJunior/laravel-xml","owner":"PHPJunior","description":"This package is a simple XML to Array converter for Laravel.","archived":false,"fork":false,"pushed_at":"2024-12-10T15:13:32.000Z","size":63,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T20:58:56.222Z","etag":null,"topics":["array","laravel","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/PHPJunior.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-15T12:05:59.000Z","updated_at":"2024-12-10T15:12:57.000Z","dependencies_parsed_at":"2024-10-17T14:49:36.459Z","dependency_job_id":"dd4fbb52-524d-4512-9a16-0337e49c170d","html_url":"https://github.com/PHPJunior/laravel-xml","commit_stats":null,"previous_names":["phpjunior/laravel-xml"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPJunior%2Flaravel-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPJunior","download_url":"https://codeload.github.com/PHPJunior/laravel-xml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981270,"owners_count":21193147,"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":["array","laravel","xml"],"created_at":"2024-10-15T19:06:30.985Z","updated_at":"2025-04-15T00:11:03.513Z","avatar_url":"https://github.com/PHPJunior.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple XML to Array Converter\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/php-junior/laravel-xml.svg?style=flat-square)](https://packagist.org/packages/php-junior/laravel-xml)\n[![Total Downloads](https://img.shields.io/packagist/dt/php-junior/laravel-xml.svg?style=flat-square)](https://packagist.org/packages/php-junior/laravel-xml)\n\nThis package is a simple XML to Array converter for Laravel.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require php-junior/laravel-xml\n```\n\n## Usage\ndefault xml root tag is `root`\n```php\nuse Illuminate\\Support\\Arr;\n\n$data = [\n    'name' =\u003e 'John Doe',\n    'description' =\u003e 'This is a \u003cstrong\u003edescription\u003c/strong\u003e',\n    'bio01' =\u003e 'This is a \u003cstrong\u003ebio01\u003c/strong\u003e',\n    'bio02' =\u003e 'This is a \u003cstrong\u003ebio02\u003c/strong\u003e',\n    'bio03' =\u003e 'This is a \u003cstrong\u003ebio03\u003c/strong\u003e',\n    'bio04' =\u003e 'This is a \u003cstrong\u003ebio04\u003c/strong\u003e',\n];\n\n$xml = Arr::toXml($data);\n\u003croot\u003e\n    \u003cname\u003eJohn Doe\u003c/name\u003e\n    ...\n\u003c/root\u003e\n\n// change root tag\n$xml = Arr::toXml($data, 'user');\n\u003cuser\u003e\n    \u003cname\u003eJohn Doe\u003c/name\u003e\n    ...\n\u003c/user\u003e\n\n// cdata tag\n$xml = Arr::toXml($data, 'user', ['description']);\n\u003cuser\u003e\n    \u003cname\u003eJohn Doe\u003c/name\u003e\n    \u003cdescription\u003e\u003c![CDATA[This is a \u003cstrong\u003edescription\u003c/strong\u003e]]\u003e\u003c/description\u003e\n    ...\n\u003c/user\u003e\n\n// cdata wildcard tag\n$xml = Arr::toXml($data, 'user', ['bio*']);\n\u003cuser\u003e\n    \u003cname\u003eJohn Doe\u003c/name\u003e\n    \u003cbio01\u003e\u003c![CDATA[This is a \u003cstrong\u003ebio01\u003c/strong\u003e]]\u003e\u003c/bio01\u003e\n    \u003cbio02\u003e\u003c![CDATA[This is a \u003cstrong\u003ebio02\u003c/strong\u003e]]\u003e\u003c/bio02\u003e\n    \u003cbio03\u003e\u003c![CDATA[This is a \u003cstrong\u003ebio03\u003c/strong\u003e]]\u003e\u003c/bio03\u003e\n    \u003cbio04\u003e\u003c![CDATA[This is a \u003cstrong\u003ebio04\u003c/strong\u003e]]\u003e\u003c/bio04\u003e\n\u003c/user\u003e\n\n// multi-dimensional array\nArr::toXml([\n    'user' =\u003e [\n        [\n            'name' =\u003e 'User',\n            'email' =\u003e 'user@user.com'\n        ],\n        [\n            'name' =\u003e 'User 2',\n            'email' =\u003e 'user2@user.com'\n        ],\n    ]\n], 'users');\n\u003cusers\u003e\n    \u003cuser\u003e\n        \u003cname\u003eUser\u003c/name\u003e\n        \u003cemail\u003euser@user.com\u003c/email\u003e\n    \u003c/user\u003e\n    \u003cuser\u003e\n        \u003cname\u003eUser 2\u003c/name\u003e\n        \u003cemail\u003euser2@user.com\u003c/email\u003e\n    \u003c/user\u003e\n\u003c/users\u003e\n\n// xml to array\n$data = Arr::fromXml($xml);\n[\n    'name' =\u003e 'John Doe',\n    'description' =\u003e 'This is a \u003cstrong\u003edescription\u003c/strong\u003e',\n    'bio01' =\u003e 'This is a \u003cstrong\u003ebio01\u003c/strong\u003e',\n    'bio02' =\u003e 'This is a \u003cstrong\u003ebio02\u003c/strong\u003e',\n    'bio03' =\u003e 'This is a \u003cstrong\u003ebio03\u003c/strong\u003e',\n    'bio04' =\u003e 'This is a \u003cstrong\u003ebio04\u003c/strong\u003e',\n]\n```\n\n### Testing\n\n```bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email nyinyilwin1992@hotmail.com instead of using the issue tracker.\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%2Fphpjunior%2Flaravel-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpjunior%2Flaravel-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpjunior%2Flaravel-xml/lists"}