{"id":15025984,"url":"https://github.com/kenlog/converter","last_synced_at":"2025-04-09T20:04:57.743Z","repository":{"id":57005592,"uuid":"264710032","full_name":"kenlog/converter","owner":"kenlog","description":"Simple converter from XML to CSV or JSON or Array","archived":false,"fork":false,"pushed_at":"2024-06-25T12:49:06.000Z","size":42,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T20:04:43.996Z","etag":null,"topics":["converter","csv-export","php72","xml-converter","xmltoarray","xmltocsv","xmltojson"],"latest_commit_sha":null,"homepage":"https://kenlog.github.io/converter/","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/kenlog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"liberapay":"kenlog","custom":["https://paypal.me/kenlog"]}},"created_at":"2020-05-17T16:29:47.000Z","updated_at":"2024-06-25T12:48:54.000Z","dependencies_parsed_at":"2025-02-15T19:31:36.801Z","dependency_job_id":"4ef97cb8-0944-4342-bbe2-37264df43ca3","html_url":"https://github.com/kenlog/converter","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/kenlog%2Fconverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenlog%2Fconverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenlog%2Fconverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenlog%2Fconverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenlog","download_url":"https://codeload.github.com/kenlog/converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103868,"owners_count":21048245,"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","csv-export","php72","xml-converter","xmltoarray","xmltocsv","xmltojson"],"created_at":"2024-09-24T20:03:26.842Z","updated_at":"2025-04-09T20:04:57.725Z","avatar_url":"https://github.com/kenlog.png","language":"PHP","funding_links":["https://liberapay.com/kenlog","https://paypal.me/kenlog"],"categories":[],"sub_categories":[],"readme":"![GitHub](https://img.shields.io/github/license/kenlog/Converter?style=flat-square)\n![Packagist Downloads](https://img.shields.io/packagist/dt/kenlog/converter)\n\n# Converter :page_facing_up: :arrows_counterclockwise: :page_with_curl:\nSimple converter from XML to CSV or JSON or Array\n\n## Getting Started\n\n## Install with composer\nby default composer will download the latest stable version.\n```\ncomposer require kenlog/converter\n```\n\n## Usage - [examples](examples)\n\n### Example conversion to CSV\n```php\n\u003c?php\n\nrequire 'vendor/autoload.php';\n\nuse Kenlog\\Converter;\n\n// @constructor new Converter(string $xml);\n$converterCSV = new Converter('products.xml');\n\n// @method setCSV(string $csv, string $xpath, array $columns, string $separator = ',', int $skipLines = 0);\n$converterCSV-\u003esetCSV('products.csv','//Product',['Code', 'Description', 'Um', 'Qty']);\n\n// @var bool success\nif ($converterCSV-\u003esuccess) {\n    echo 'The XML file has been converted to CSV';\n} else {\n    echo 'The XML file was not converted to CSV';\n}\n```\n\n### Example conversion to JSON\n```php\n\u003c?php\n\nrequire 'vendor/autoload.php';\n\nuse Kenlog\\Converter;\n\n// @constructor new Converter(string $xml);\n$converterJSON = new Converter('products.xml');\n\n// @method setJSON(string $jsonFile);\n$converterJSON-\u003esetJSON('products.json');\n\n// @var bool success\nif ($converterJSON-\u003esuccess) {\n    echo 'The XML file has been converted to JSON';\n} else {\n    echo 'The XML file was not converted to JSON';\n}\n```\n\n### Example conversion to Array \n```php\n\u003c?php\n\nrequire 'vendor/autoload.php';\n\nuse Kenlog\\Converter;\n\n// @constructor new Converter(string $xml);\n$converterArray = new Converter('products.xml');\n\n// @array getArray();\n$products = $converterArray-\u003egetArray();\n\n// The result will be an array containing all records\nforeach ($products['Product'] as $product) {\n    echo $product['Code'] . PHP_EOL;\n    echo $product['Description'] . PHP_EOL;\n    echo $product['Um'] . PHP_EOL;\n    echo $product['Qty'] . PHP_EOL;\n}\n```\n\n:construction_worker: Any contribution will be highly appreciated\n------------\nClone the repository: \n```console \ngit clone https://github.com/kenlog/converter.git\n```\n:bug: Issues\n------------\nPlease [create an issue](https://github.com/kenlog/converter/issues) for any bugs you've found.\n\n## Author\n\n* **Valentino Pesce** - [Kenlog](https://github.com/kenlog)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenlog%2Fconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenlog%2Fconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenlog%2Fconverter/lists"}