{"id":22725082,"url":"https://github.com/katmore/micro-encode","last_synced_at":"2025-03-29T23:22:33.611Z","repository":{"id":57004769,"uuid":"112693428","full_name":"katmore/micro-encode","owner":"katmore","description":"xml encoder and html generator","archived":false,"fork":false,"pushed_at":"2018-12-06T00:59:08.000Z","size":66,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T00:44:16.635Z","etag":null,"topics":["encoder","encoding","html-generation","html-generator","php","php-library","php7","phpunit-tests","vanilla-php","xml-serialization"],"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/katmore.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-12-01T04:05:10.000Z","updated_at":"2020-02-26T13:54:23.000Z","dependencies_parsed_at":"2022-08-21T12:10:50.301Z","dependency_job_id":null,"html_url":"https://github.com/katmore/micro-encode","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katmore%2Fmicro-encode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katmore%2Fmicro-encode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katmore%2Fmicro-encode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katmore%2Fmicro-encode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katmore","download_url":"https://codeload.github.com/katmore/micro-encode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246256093,"owners_count":20748190,"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":["encoder","encoding","html-generation","html-generator","php","php-library","php7","phpunit-tests","vanilla-php","xml-serialization"],"created_at":"2024-12-10T15:08:48.107Z","updated_at":"2025-03-29T23:22:33.588Z","avatar_url":"https://github.com/katmore.png","language":"PHP","readme":"# MicroEncode\nxml encoder and html generator\n\n## Installation\nuse composer to add **MicroEncode** to your PHP project:\n```\ncomposer require katmore/micro-encode\n```\n\n## Usage\n * [Encoding data to XML](#xmlencoder-usage) - XmlEncoder Usage\n * [Generating HTML from data](#htmlencoder-usage) - HtmlEncoder Usage\n\n### XmlEncoder Usage\nThe [`XMLEncoder`](./src/MicroEncode/XmlEncoder.php) class serializes an XML document from arbitrary data. The [PHP data types](http://php.net/manual/en/language.types.intro.php) supported are: [`boolean`](http://php.net/manual/en/language.types.boolean.php), [`integer`](http://php.net/manual/en/language.types.integer.php), [`float`](http://php.net/manual/en/language.types.float.php), [`string`](http://php.net/manual/en/language.types.string.php), [`array`](http://php.net/manual/en/language.types.array.php), [`object`](http://php.net/manual/en/language.types.object.php), and [`null`](http://php.net/manual/en/language.types.null.php). The XML document conforms to the [Flat XML Schema](https://github.com/katmore/flat/wiki/xmlns) specification.\n\nThe following is an example of encoding associative array data into an XML document:\n```php\n$myData = [\n   'my_example_1'=\u003e'my 1st data value',\n   'my_example_2'=\u003e'my 2nd data value',\n];\n\necho (new \\MicroEncode\\XmlEncoder($myData));\n```\nThe above code should output the following XML:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cfx:data xmlns:fx=\"https://github.com/katmore/flat/wiki/xmlns\" xmlns=\"https://github.com/katmore/flat/wiki/xmlns-object\" fx:md5=\"37a6259cc0c1dae299a7866489dff0bd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:extxs=\"https://github.com/katmore/flat/wiki/xmlns-extxs\" xsi:type=\"extxs:Hashmap\"\u003e\n   \u003cmy_example_1 xsi:type=\"xs:string\"\u003emy 1st data value\u003c/my_example_1\u003e\n   \u003cmy_example_2 xsi:type=\"xs:string\"\u003emy 2nd data value\u003c/my_example_2\u003e\n\u003c/fx:data\u003e\n```\n\n### HtmlEncoder Usage\nThe [`HtmlEncoder`](./src/MicroEncode/HtmlEncoder.php) class generates HTML from arbitrary data. The [PHP data types](http://php.net/manual/en/language.types.intro.php) supported are: [`boolean`](http://php.net/manual/en/language.types.boolean.php), [`integer`](http://php.net/manual/en/language.types.integer.php), [`float`](http://php.net/manual/en/language.types.float.php), [`string`](http://php.net/manual/en/language.types.string.php), [`array`](http://php.net/manual/en/language.types.array.php), [`object`](http://php.net/manual/en/language.types.object.php), and [`null`](http://php.net/manual/en/language.types.null.php).\n\nThe following is an example of generating HTML from associative array data:\n```php\n$myData = [\n   'my_example_1'=\u003e'my 1st data value',\n   'my_example_2'=\u003e'my 2nd data value',\n];\n\necho (new \\MicroEncode\\HtmlEncoder($myData));\n```\nThe above code should output the following HTML:\n```html\n\u003cul data-type=\"array\"\u003e\n   \u003cli data-index=\"0\" data-key=\"my_example_1\" data-role=\"item\"\u003e\u003cspan data-role=\"item-key\"\u003emy_example_1\u003c/span\u003e:\u0026nbsp;\u003cspan data-role=\"item-value\" data-type=\"string\"\u003emy 1st data value\u003c/span\u003e\u003c/li\u003e\u003c!--/data-item: (my_example_1)--\u003e\n   \u003cli data-index=\"1\" data-key=\"my_example_2\" data-role=\"item\"\u003e\u003cspan data-role=\"item-key\"\u003emy_example_2\u003c/span\u003e:\u0026nbsp;\u003cspan data-role=\"item-value\" data-type=\"string\"\u003emy 2nd data value\u003c/span\u003e\u003c/li\u003e\u003c!--/data-item: (my_example_2)--\u003e\n\u003c/ul\u003e\n```\n\nThe above HTML would render into set of unordered list items as follows:\n * my_example_1: my 1st data value\n * my_example_2: my 2nd data value\n\n## Unit Tests\n * [`coverage.txt`](./coverage.txt): unit test coverage report\n * [`phpunit.xml`](./phpunit.xml): PHPUnit configuration file\n * [`tests/Unit`](./tests/Unit): source code for unit tests\n\nTo perform unit tests, execute phpunit located in the `vendor/bin` directory.\n```sh\nvendor/bin/phpunit\n```\n\nThe [`tests.sh`](./tests.sh) wrapper script is provided for convenience.\n```sh\n./tests.sh\n```\n\n## Legal\n### Copyright\nMicroEncode - https://github.com/katmore/micro-encode\n\nCopyright (c) 2012-2018 Doug Bird. All Rights Reserved.\n\n### License\nMicroEncode is copyrighted free software.\nYou may redistribute and modify it under either the terms and conditions of the\n\"The MIT License (MIT)\"; or the terms and conditions of the \"GPL v3 License\".\nSee [LICENSE](https://github.com/katmore/micro-encode/blob/master/LICENSE) and [GPLv3](https://github.com/katmore/micro-encode/blob/master/GPLv3).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatmore%2Fmicro-encode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatmore%2Fmicro-encode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatmore%2Fmicro-encode/lists"}