{"id":19133912,"url":"https://github.com/rummykhan/easy-xml","last_synced_at":"2026-05-08T09:32:59.968Z","repository":{"id":62538150,"uuid":"111417603","full_name":"rummykhan/easy-xml","owner":"rummykhan","description":"Convert your data to XML easily","archived":false,"fork":false,"pushed_at":"2017-11-21T08:09:50.000Z","size":17,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-03T06:54:42.517Z","etag":null,"topics":["conver-data-to-xml","laravel","xml","yii2"],"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/rummykhan.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-11-20T14:01:01.000Z","updated_at":"2017-11-21T07:57:17.000Z","dependencies_parsed_at":"2022-11-02T15:17:12.977Z","dependency_job_id":null,"html_url":"https://github.com/rummykhan/easy-xml","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/rummykhan/easy-xml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rummykhan%2Feasy-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rummykhan%2Feasy-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rummykhan%2Feasy-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rummykhan%2Feasy-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rummykhan","download_url":"https://codeload.github.com/rummykhan/easy-xml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rummykhan%2Feasy-xml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32774855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["conver-data-to-xml","laravel","xml","yii2"],"created_at":"2024-11-09T06:24:22.857Z","updated_at":"2026-05-08T09:32:59.947Z","avatar_url":"https://github.com/rummykhan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyXML\n\nThis package helps you in converting your data to XML easily.\nThis package is independent of any php framework.\nBut I took care of two popular frameworks specifically\n\n1. [For use in Laravel](https://github.com/rummykhan/easy-xml/blob/master/Laravel.md)\n2. [For use in YII 2.0](https://github.com/rummykhan/easy-xml/blob/master/YII-2.0.md)\n\n## To use in any framework\n\n### Installation\n\nInstall using composer\n\n```bash\ncomposer require rummykhan/easy-xml\n```\n\nWit the constructor initialization you can use it any framework you may like.\n\n```php\n$rootNode = new XmlNode('person');\n\n$educationNode = new XmlNode('education');\n$educationNode-\u003eaddAttributes(['MOE' =\u003e 'SXC', 'DAE' =\u003e 'COE', 'BA' =\u003e 'UOS']);\n$rootNode-\u003eaddChildNode($educationNode);\n\n$jobNode = new XmlNode('job');\n\n$jobNode-\u003eaddAttribute('first', 'https://best-bf.com');\n$jobNode-\u003eaddAttribute('second', 'https://infamous.ae');\n$jobNode-\u003eaddAttribute('third', 'https://awok.com');\n$jobNode-\u003eaddAttribute('fourth', 'https://helpbit.com');\n\n$rootNode-\u003eaddChildNode($jobNode)\n    -\u003esetDeclaration(XmlDeclaration::V1);\n\n// since it implements php __toString() method\ndd((string)$rootNode);\n// OR\ndd($rootNode-\u003etoString());\n```\n\nwill output\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cperson\u003e\n   \u003ceducation MOE=\"SXC\" DAE=\"COE\" BA=\"UOS\" /\u003e\n   \u003cjob first=\"https://best-bf.com\" second=\"https://infamous.ae\" third=\"https://awok.com\" fourth=\"https://helpbit.com\" /\u003e\n\u003c/person\u003e\n```\n\n\n## `RummyKhan\\EasyXml\\XmlNode` API\n\n### `addChildNode`\n\nTo add a child node to XmlNode.\ne.g.\n\n```php\n$rootNode = new XmlNode('employees');\n$employeeNode = new XmlNode('employee');\n\n$rootNode-\u003eaddChildNode($employeeNode);\n```\n\n### `setValue`\nTo set the value of the node. Node can either have other node as children or it has a primitive value.\n\n```php\n$rootNode = new XmlNode('name');\n$rootNode-\u003esetValue('rummykhan');\n```\n\n### `addAttribute`\nTo add the attribute for the xml node.\n\n```php\n$rootNode = new XmlNode('person');\n$rootNode-\u003eaddAttribute('age', 30);\n```\n\n### `addAttributes`\nTo add multiple attributes for the xml node.\ne.g.\n\n```php\n$rootNode = new XmlNode('person');\n$rootNode-\u003eaddAttributes([\n    'name' =\u003e 'rummykhan',\n    'age' =\u003e 30\n]);\n```\n\n### `setDeclaration`\nTo set the [Xml declaration](http://xmlwriter.net/xml_guide/xml_declaration.shtml)\n\n```php\n$rootNode = new XmlNode('employees');\n$rootNode-\u003esetDeclaration('\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?\u003e');\n```\n\n\n### `toString`\nTo convert xml single node or xml node hierarchy to xml string.\n\n```php\n$rootNode = new XmlNode('employees');\ndd($rootNode-\u003etoString());\n```\n\n### Contact\n[rehan_manzoor@outlook.com](mailto://rehan_manzoor@outlook.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frummykhan%2Feasy-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frummykhan%2Feasy-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frummykhan%2Feasy-xml/lists"}