{"id":24716744,"url":"https://github.com/baylorrae/htmlgen","last_synced_at":"2025-10-09T13:31:47.398Z","repository":{"id":137876972,"uuid":"1569487","full_name":"BaylorRae/htmlgen","owner":"BaylorRae","description":"A lightweight DSL for HTML generation in PHP 5.3","archived":false,"fork":false,"pushed_at":"2011-05-03T18:35:26.000Z","size":449,"stargazers_count":2,"open_issues_count":0,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T02:51:14.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"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/BaylorRae.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":"2011-04-04T22:17:12.000Z","updated_at":"2021-01-15T19:20:04.000Z","dependencies_parsed_at":"2023-04-01T16:07:54.136Z","dependency_job_id":null,"html_url":"https://github.com/BaylorRae/htmlgen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BaylorRae/htmlgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaylorRae%2Fhtmlgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaylorRae%2Fhtmlgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaylorRae%2Fhtmlgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaylorRae%2Fhtmlgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BaylorRae","download_url":"https://codeload.github.com/BaylorRae/htmlgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BaylorRae%2Fhtmlgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001484,"owners_count":26083102,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-01-27T09:14:05.014Z","updated_at":"2025-10-09T13:31:47.091Z","avatar_url":"https://github.com/BaylorRae.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# htmlgen\n\nA lightweight DSL for HTML generation in PHP\n\n## Requirements\n\nPHP \u003e= 5.3\n\n## Code example\n```php\n    \u003c?php\n\n    require \"lib.htmlgen.php\";\n\n    $table_data = array(\n      \"foo\" =\u003e \"bar\",\n      \"hello\" =\u003e \"world\",\n      \"123\" =\u003e \"456\",\n      \"abc\" =\u003e \"xyz\"\n    );\n\n    h::set_indent_pattern(\"  \");\n\n    h::html(function(){\n      h::head(function(){\n        h::meta(array(\"http-equiv\"=\u003e\"Content-Type\", \"content\"=\u003e\"text/html; charset=UTF-8\"));\n        h::link(array(\"rel\"=\u003e\"stylesheet\", \"type\"=\u003e\"text/css\", \"href\"=\u003e\"global.css\"));\n      });\n      h::body(function(){\n        h::div(array(\"id\"=\u003e\"wrapper\"), function(){\n          h::h1(\"Hello, World\", array(\"class\"=\u003e\"title\"));\n\n          h::comment(\"navigation\");\n          h::ul(array(\"class\"=\u003e\"links\"), function(){\n            foreach(array(1,2,3) as $x)\n              h::li(function() use($x){\n                h::a(\"Link {$x}\", \"#{$x}\");\n              });\n          });\n\n          h::comment(\"let's see some text\");\n          h::p(\"Lorem ipsum dolor sit amet, consectetur adipisicing elit...\");\n\n          h::comment(\"now for a table\");\n          h::table(function(){\n\n            # sadly, i'm not sure how to get around this at the moment :(  help me make this awesome\n            global $table_data;\n\n            h::tr(array(\"class\"=\u003e\"header\"), function(){\n              h::th(\"key\");\n              h::th(\"value\");\n            });\n            foreach($table_data as $k =\u003e $v){\n              h::tr(array(\"class\"=\u003eh::cycle(array(\"odd\", \"even\"))), function() use($k,$v){\n                h::td($k);\n                h::td($v);\n              });\n            }\n          });\n\n        });\n      });\n    });\n\n    ?\u003e\n```    \n\n## Output\n\n    \u003chtml\u003e\n      \u003chead\u003e\n        \u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /\u003e\n        \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"global.css\" /\u003e\n      \u003c/head\u003e\n      \u003cbody\u003e\n        \u003cdiv id=\"wrapper\"\u003e\n          \u003ch1 class=\"title\"\u003eHello, World\u003c/h1\u003e\n\n          \u003c!-- navigation --\u003e\n          \u003cul class=\"links\"\u003e\n            \u003cli\u003e\n              \u003ca href=\"#1\"\u003eLink 1\u003c/a\u003e\n            \u003c/li\u003e\n            \u003cli\u003e\n              \u003ca href=\"#2\"\u003eLink 2\u003c/a\u003e\n            \u003c/li\u003e\n            \u003cli\u003e\n              \u003ca href=\"#3\"\u003eLink 3\u003c/a\u003e\n            \u003c/li\u003e\n          \u003c/ul\u003e\n\n          \u003c!-- let's see some text --\u003e\n          \u003cp\u003eLorem ipsum dolor sit amet, consectetur adipisicing elit...\u003c/p\u003e\n\n          \u003c!-- now for a table --\u003e\n          \u003ctable\u003e\n            \u003ctr class=\"header\"\u003e\n              \u003cth\u003ekey\u003c/th\u003e\n              \u003cth\u003evalue\u003c/th\u003e\n            \u003c/tr\u003e\n            \u003ctr class=\"odd\"\u003e\n              \u003ctd\u003efoo\u003c/td\u003e\n              \u003ctd\u003ebar\u003c/td\u003e\n            \u003c/tr\u003e\n            \u003ctr class=\"even\"\u003e\n              \u003ctd\u003ehello\u003c/td\u003e\n              \u003ctd\u003eworld\u003c/td\u003e\n            \u003c/tr\u003e\n            \u003ctr class=\"odd\"\u003e\n              \u003ctd\u003e\u003c/td\u003e\n              \u003ctd\u003e456\u003c/td\u003e\n            \u003c/tr\u003e\n            \u003ctr class=\"even\"\u003e\n              \u003ctd\u003eabc\u003c/td\u003e\n              \u003ctd\u003exyz\u003c/td\u003e\n            \u003c/tr\u003e\n          \u003c/table\u003e\n        \u003c/div\u003e\n      \u003c/body\u003e\n    \u003c/html\u003e\n    \n\n## Try it and see!\n\n    $ cd htmlgen\n    $ php example.php\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaylorrae%2Fhtmlgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaylorrae%2Fhtmlgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaylorrae%2Fhtmlgen/lists"}