{"id":22061704,"url":"https://github.com/floofies/microvdom","last_synced_at":"2025-07-24T01:32:09.557Z","repository":{"id":135350503,"uuid":"90411221","full_name":"Floofies/microVDom","owner":"Floofies","description":"A virtual Document Object Model for PHP and JavaScript","archived":true,"fork":false,"pushed_at":"2017-10-21T16:47:47.000Z","size":7,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T17:35:18.998Z","etag":null,"topics":["classes","html","html-renderer","minimalist","php","virtual-dom"],"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/Floofies.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-05T19:48:21.000Z","updated_at":"2024-02-14T07:41:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4fdd74c-e3ee-4ebc-b74a-4e06dc046af8","html_url":"https://github.com/Floofies/microVDom","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Floofies/microVDom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2FmicroVDom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2FmicroVDom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2FmicroVDom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2FmicroVDom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Floofies","download_url":"https://codeload.github.com/Floofies/microVDom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Floofies%2FmicroVDom/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266778999,"owners_count":23982847,"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-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["classes","html","html-renderer","minimalist","php","virtual-dom"],"created_at":"2024-11-30T18:14:08.014Z","updated_at":"2025-07-24T01:32:09.547Z","avatar_url":"https://github.com/Floofies.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# microVDom\n\n**microVDom** is a tiny (under 300 lines) PHP Virtual DOM solution for minimalist creation and rendering of HTML.\n\nOnly the bare minimum of DOM methods are included to quickly write a presentation layer, completely eschewing parsing and query methods. Only a small subset of command methods are supported.\n\nDue to the lack of mutating command methods, the `microDocument` is effectively WORM (Write Once, Read Many).\n\n___\n\n# Usage\n\nHere is a small usage example:\n```PHP\n\u003c?php\n  // Include the microVDom file:\n  include(\"microVDom.php\");\n\n  // Create a new empty microDocument:\n  $document = new microDocument(\"html\");\n\n  // Create a new div with a class attribute:\n  $myDiv = $document-\u003ecreateElement(\"div\", [\"class\" =\u003e \"myClass\"]);\n\n  // Add a text node to the div:\n  $myDiv-\u003eappendChild(\"Hello World!\");\n\n  // Append the document body with the div:\n  $document-\u003ebody-\u003eappendChild($myDiv);\n\n  // Render the HTML:\n  $myHTML = $document-\u003erender();\n?\u003e\n```\nWhen the code runs, `$myHTML` will contain the following HTML string:\n```HTML\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n  \u003chead\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cdiv class=\"myClass\"\u003eHello World\u0026#33;\u003c/div\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n# Documentation\n\n## `microDocument`\n\n###### Class\n\n```JavaScript\nnew microDocument( string $docType );\n```\n\nThe primary controller/container class.\n\n\n### Instantiating\nReturns a new instance of the `microDocument` class. The new object has two children, the `DOCTYPE` declaration and `\u003chtml\u003e`; which then has two children as well, `\u003chead\u003e` and `\u003cbody\u003e`.\n```PHP\n$document = new microDocument(\"html\");\n```\n\n##### Constructor Parameters\n- String **`docType`**\n\n  An arbitrary string used in the `\u003c!DOCTYPE ...\u003e` declaration.\n\n### Member Variables\n- String **`docType`**\n\n  An arbitrary string used in the `\u003c!DOCTYPE ...\u003e` declaration.\n\n- Element **`documentElement`**\n\n  The direct child of the `microDocument`. Default is an `\u003chtml\u003e` element.\n\n- Element **`body`**\n\n  The `\u003cbody\u003e` element of the `\u003chtml\u003e` element.\n\n- Element **`head`**\n\n  The `\u003chead\u003e` element of the `\u003chtml\u003e` element.\n\n### Member Methods\n#### `createAttribute`\n\n###### Function\n```PHP\nmicroDocument-\u003ecreateAttribute( string $name , string $value );\n```\nReturns a clone of `object`.\n\n##### Parameters\n- String **`name`**\n\n  The name of the new attribute.\n\n- String **`value`**\n\n  The value of the new attribute.\n\n##### Example\n```PHP\n// Instantiate a new Attr Object\n$myAttr = $document-\u003ecreateAttribute(\"myAttr\", \"myValue\");\n\n// Instantiate a new Element Object\n$myDiv = $document-\u003ecreateElement(\"div\");\n\n// Set the new attribute on the Element Object\n$myDiv-\u003esetAttribute($myAttr);\n\n// Render the HTML\n$myHTML = $myDiv-\u003erender();\n```\n\n`$myHTML` now contains an HTML string:\n```HTML\n\u003cdiv myAttr=\"myValue\"\u003e\u003c/div\u003e\n```\n\n# WIP\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloofies%2Fmicrovdom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloofies%2Fmicrovdom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloofies%2Fmicrovdom/lists"}