{"id":19951297,"url":"https://github.com/palmtreephp/html","last_synced_at":"2025-07-11T12:36:49.176Z","repository":{"id":57035260,"uuid":"71888760","full_name":"palmtreephp/html","owner":"palmtreephp","description":":palm_tree: OOP style HTML elements and selectors","archived":false,"fork":false,"pushed_at":"2022-07-12T11:41:22.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T06:10:12.854Z","etag":null,"topics":["composer-package","html","html-renderer","php"],"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/palmtreephp.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":"2016-10-25T11:07:41.000Z","updated_at":"2022-01-08T13:00:00.000Z","dependencies_parsed_at":"2022-08-23T20:50:59.316Z","dependency_job_id":null,"html_url":"https://github.com/palmtreephp/html","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fhtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fhtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fhtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fhtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palmtreephp","download_url":"https://codeload.github.com/palmtreephp/html/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241381520,"owners_count":19953749,"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":["composer-package","html","html-renderer","php"],"created_at":"2024-11-13T01:07:28.287Z","updated_at":"2025-03-01T14:43:40.750Z","avatar_url":"https://github.com/palmtreephp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :palm_tree: Palmtree Html\n\n[![License](http://img.shields.io/packagist/l/palmtree/form.svg)](LICENSE)\n[![Build](https://img.shields.io/github/workflow/status/palmtreephp/html/Build.svg)](https://github.com/palmtreephp/html/actions/workflows/build.yml)\n\nBuild and render HTML elements using an OOP style interface and jQuery style selectors.\n\n## Requirements\n* PHP \u003e= 7.1\n\n## Installation\n\nUse composer to add the package to your dependencies:\n```bash\ncomposer require palmtree/html\n```\n\n## Usage Example\n```php\n\u003c?php\nuse Palmtree\\Html\\Element;\n\n$menu = new Element('ul.some-class');\n\n$menuItems = [];\n\n$menuItems[] = [\n    'label' =\u003e 'Home',\n    'href'  =\u003e 'https://example.org',\n];\n\n$menuItems[] = [\n    'label' =\u003e 'About',\n    'href'  =\u003e 'https://example.org/about',\n];\n\n$menuItems[] = [\n    'label' =\u003e 'Contact',\n    'href'  =\u003e 'https://example.org/contact',\n];\n\nforeach ($menuItems as $item) {\n    $a = Element::create('a[href=\"' . $item['href'] . '\"]')-\u003esetInnerText($item['label']);\n\n    $li = Element::create('li.item')-\u003eaddChild($a);\n    $li-\u003eclasses[] = 'item-' . strtolower($item['label']);\n\n    $menu-\u003eaddChild($li);\n}\n\n\n$menu-\u003eattributes-\u003esetData('item_total', (string)count($menuItems));\n$menu-\u003eattributes['aria-label'] = 'Navigation'\n\necho $menu-\u003erender();\n\n?\u003e\n```\n\nRenders the following HTML:\n\n```html\n\u003cul class=\"some-class\" data-item_total=\"3\" aria-label=\"Navigation\"\u003e\n    \u003cli class=\"item item-home\"\u003e\n        \u003ca href=\"https://example.org\"\u003eHome\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli class=\"item item-about\"\u003e\n        \u003ca href=\"https://example.org/about\"\u003eAbout\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli class=\"item item-contact\"\u003e\n        \u003ca href=\"https://example.org/contact\"\u003eContact\u003c/a\u003e\n    \u003c/li\u003e\n\u003c/ul\u003e\n```\n\n## License\n\nReleased under the [MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmtreephp%2Fhtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalmtreephp%2Fhtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmtreephp%2Fhtml/lists"}