{"id":15026508,"url":"https://github.com/tei187/php-html-builder","last_synced_at":"2025-07-11T18:38:07.871Z","repository":{"id":61809503,"uuid":"555262963","full_name":"tei187/php-html-builder","owner":"tei187","description":"Generates HTML elements (Bootstrap and OpenGraph implementation included).","archived":false,"fork":false,"pushed_at":"2023-08-08T07:03:00.000Z","size":125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-19T20:26:32.167Z","etag":null,"topics":["css","html","html-generator","opengraph","php-html","php74","twitter"],"latest_commit_sha":null,"homepage":"","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/tei187.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-21T08:38:32.000Z","updated_at":"2022-11-28T10:01:21.000Z","dependencies_parsed_at":"2024-09-28T20:00:27.424Z","dependency_job_id":null,"html_url":"https://github.com/tei187/php-html-builder","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.1578947368421053,"last_synced_commit":"aebbcbe146f6e2fc8b4b0037a818e1a7b52b9737"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tei187%2Fphp-html-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tei187%2Fphp-html-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tei187%2Fphp-html-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tei187%2Fphp-html-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tei187","download_url":"https://codeload.github.com/tei187/php-html-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330323,"owners_count":20274039,"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":["css","html","html-generator","opengraph","php-html","php74","twitter"],"created_at":"2024-09-24T20:04:36.142Z","updated_at":"2025-03-13T03:15:26.087Z","avatar_url":"https://github.com/tei187.png","language":"PHP","readme":"# **PHP-TO-HTML package**\n\n## **About**\n---\nScripts meant to help out with organizing HTML tag building through PHP, for a rather specific one case but makes sense enough to try out, if you really don't want/need Twig :D\n\n### **Features:**\n * **Basic HTML** builder (content, forms, all the parts of HEAD you tend to google for),\n * **Bootstrap** equivalent builder,\n * **Constants** for Charset, Doctype and Vocabularies,\n * **OpenGraph** handling: namespaces, default types, Twitter.\n\n\u003cbr\u003e\n\n## **Installation**\n---\n### **Composer**\n```shell\n    composer require tei187/php-html-builder\n```\n\n\u003cbr\u003e\n\n## **Examples**\n---\n### **Basic HTML**\n#### *Input:*\n```php\n    use tei187\\HTMLBuilder\\Constants\\Charset;\n    use tei187\\HTMLBuilder\\HTML;\n    use tei187\\HTMLBuilder\\Head;\n    use tei187\\HTMLBuilder\\OpenGraph;\n    use tei187\\HTMLBuilder\\OpenGraph\\Prefixes;\n    \n    echo\n        HTML::Doctype() . \n        HTML::Html( [ 'prefix' =\u003e Prefixes::og, 'lang' =\u003e \"en-US\" ],\n            HTML::Head(\n                Head::Charset( Charset::UTF8 ) . \n                Head::Title(\"Testing page\") . \n                OpenGraph::Type('website') . \n                OpenGraph::Url('localhost') . \n                OpenGraph::SiteName(\"Testing page\") .\n                OpenGraph::Description(\"Just a testing page for HTML builder based on PHP\") . \n                Head::StyleSheet(\"/assets/css/style.min.css\")\n            ) . \n            HTML::Body( [ 'class' =\u003e \"main\" ], \n                HTML::Heading( 1, [ 'class' =\u003e 'text-red' ], \"Hello World!\" ) .\n                HTML::Paragraph( [], \"Paragraph example\" )\n            )\n        );\n```\n#### *Output:*\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml prefix='og: http://ogp.me/ns#' lang='en-US'\u003e\n    \u003chead\u003e\n        \u003cmeta charset='UTF-8'/\u003e\n        \u003ctitle\u003eTesting page\u003c/title\u003e\n        \u003cmeta property='og:type' content='website'/\u003e\n        \u003cmeta property='og:url' content='localhost'/\u003e\n        \u003cmeta property='og:site_name' content='Testing page'/\u003e\n        \u003cmeta property='og:description' content='Just a testing page for HTML builder based on PHP'/\u003e\n        \u003clink rel='stylesheet' href='/assets/css/style.min.css'/\u003e\n    \u003c/head\u003e\n    \u003cbody class='main'\u003e\n        \u003ch1 class='text-red'\u003eHello World!\u003c/h1\u003e\n        \u003cp\u003eParagraph example\u003c/p\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n---\n\n### **Bootstrap**\n#### *Input:*\n```php\n    use tei187\\HTMLBuilder\\HTML;\n    use tei187\\HTMLBuilder\\Head;\n    use tei187\\HTMLBuilders\\Bootstrap;\n\n    echo\n        HTML::Doctype() .\n        HTML::Html([], \n            HTML::Head(\n                Head::Charset() .\n                Head::Viewport() . \n                Head::Title(\"Bootstrap Example\") .\n                Head::StyleSheet(\n                    \"https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css\", \n                    null,\n                    [ \n                        'integrity' =\u003e \"sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65\", \n                        'crossorigin' =\u003e \"anonymous\",\n                    ]\n                )\n            ) . \n            HTML::Body([], \n                Bootstrap::Container([], \n                    HTML::Heading(1, [], \"Heading\") . \n                    Bootstrap::Row([], \n                        Bootstrap::Col(['class' =\u003e 'col-12 col-md-6'],\n                            HTML::Image(['alt' =\u003e 'Image alternative text'], \"/assets/img/image.jpg\") . \n                            HTML::Paragraph([], \"Paragraph\")\n                        )\n                    )\n                ) . \n                HTML::Script(\n                    [\n                        'src' =\u003e \"https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js\",\n                        'integrity' =\u003e \"sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4\",\n                        'crossorigin' =\u003e \"anonymous\",\n                    ]\n                )\n            )\n        );\n```\n#### *Output:*\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cmeta charset='UTF-8'/\u003e\n        \u003cmeta name='viewport' content='width=device-width, initial-scale=1'/\u003e\n        \u003ctitle\u003eBootstrap Example\u003c/title\u003e\n        \u003clink rel='stylesheet' \n              href='https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css' \n              integrity='sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65' \n              crossorigin='anonymous' /\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cdiv class='container'\u003e\n            \u003ch1\u003eHeading\u003c/h1\u003e\n            \u003cdiv class='row'\u003e\n                \u003cdiv class='col col-12 col-md-6'\u003e\n                    \u003cimg src='/assets/img/image.jpg' alt='Image alternative text'/\u003e\n                    \u003cp\u003eParagraph\u003c/p\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n        \u003cscript src='https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js' \n                integrity='sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4' \n                crossorigin='anonymous'\u003e\u003c/script\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\u003cbr\u003e\n\n## **Requires**\n---\n - **UtilitiesPHP** : *tei187/utilities-php* ([GitHub](https://github.com/tei187/UtilitiesPHP) | [Packagist](https://packagist.org/packages/tei187/utilities-php))\n\n\u003cbr\u003e\n\n## **Author**\n---\n - [tei187](https://github.com/tei187)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftei187%2Fphp-html-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftei187%2Fphp-html-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftei187%2Fphp-html-builder/lists"}