{"id":22314377,"url":"https://github.com/undercloud/leaf","last_synced_at":"2025-07-15T18:38:58.596Z","repository":{"id":30663093,"uuid":"34218825","full_name":"undercloud/leaf","owner":"undercloud","description":"PHP DOM Generator","archived":false,"fork":false,"pushed_at":"2016-04-10T05:41:54.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T00:18:17.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/undercloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-19T18:31:24.000Z","updated_at":"2020-05-01T02:55:30.000Z","dependencies_parsed_at":"2022-08-17T17:00:52.119Z","dependency_job_id":null,"html_url":"https://github.com/undercloud/leaf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undercloud%2Fleaf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undercloud%2Fleaf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undercloud%2Fleaf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/undercloud%2Fleaf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/undercloud","download_url":"https://codeload.github.com/undercloud/leaf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245579582,"owners_count":20638676,"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":[],"created_at":"2024-12-03T22:09:53.082Z","updated_at":"2025-03-26T02:46:01.854Z","avatar_url":"https://github.com/undercloud.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leaf\nPHP DOM Generator\n\n##install\n```composer require unercloud/leaf```\n\n##simple example\n```PHP\n\t$l = new \\Undercloud\\Leaf();\n\n\t$l-\u003eel('html')\n\t\t-\u003eel('body')\n\t\t\t-\u003eel('h1#id.classname','Heading')-\u003eend\n\t\t\t-\u003eel('p',array('class' =\u003e 'article'),'Lorem ipsum...')-\u003eend\n\t\t\t-\u003eel('input:text',array('value'=\u003e'text'))\n\t\t-\u003eend\n\t-\u003eend;\n\n\techo $l;\n```\n\n##constructor\n\n```PHP\n\t$l = new \\Undercloud\\Leaf(\n\t\tarray(\n\t\t\t//format tree\n\t\t\t'format' =\u003e true,\n\t\t\t//indent in formatted tree, default two spaces\n\t\t\t'indent' =\u003e '  ',\n\t\t\t//define own single tags\n\t\t\t'selfclosing' =\u003e array(...)\n\t\t)\n\t);\n\n```\n\n##methods\n**el** - create element\n```PHP\n$l-\u003eel('tag')\n```\nor\n```PHP\n$l-\u003eel('tag','text')\n```\nor\n```PHP\n$l-\u003eel('tag',array $attr)\n```\nor\n```PHP\n$l-\u003eel('tag',array $attr,'text')\n```\n\nYou can combine tag with #id and .classname shortcut e.g.\n```PHP\n$l-\u003eel('span#id.classname.anotherclass')\n```\nInput[type] attr helper for button,checkbox,file,hidden,image,password,radio,reset,submit,text e.g.\n```PHP\n$l-\u003eel('input:text')\n```\n\nSingle attr helper for 'checked','disabled','readonly','required','multiple e.g.\n```PHP\n$l-\u003eel('select:multiple')\n```\n\n**text** - create text node\n```PHP\n$l-\u003etext('any content')\n```\n\n**raw** - add raw data wihout escaping\n```PHP\n$l-\u003eraw('raw content')\n```\n\n**end** - close tag\n```PHP\n$l-\u003eend() // or $l-\u003eend\n```\n\n##helpers\n**init** - create instance\n```PHP\nUndercloud\\Leaf::init($opt = array())\n```\n**escape** - escape special chars\n```PHP\nUndercloud\\Leaf::escape($s)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundercloud%2Fleaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fundercloud%2Fleaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fundercloud%2Fleaf/lists"}