https://github.com/phore/phore-html
Html Elements and fluent html api
https://github.com/phore/phore-html
html-element phore-html
Last synced: 20 days ago
JSON representation
Html Elements and fluent html api
- Host: GitHub
- URL: https://github.com/phore/phore-html
- Owner: phore
- License: mit
- Created: 2018-07-13T12:18:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-06T12:39:25.000Z (over 2 years ago)
- Last Synced: 2025-09-26T22:59:05.144Z (5 months ago)
- Topics: html-element, phore-html
- Language: PHP
- Homepage: https://infracamp.org/project/phore/
- Size: 42 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Phore HTML Toolkit
- Fluent API for creating HTML Elements
- Create, alter, render
## Basic example
```php
// Create a div element:
$elem = fhtml("div @id=main @class=website");
// Append a
to the
$elem[] = [
"div @id=content" => "Some Content"
];
// Append paragraph to content div:
$elem["?#content"][] = ["p" => "Some escaped content"];
// Render full page including html-header
echo $elem->renderPage();
```
will output:
```html
Some Content
Some escaped content
```
## Creating html structures
```
$doc = fhtml("div @id=name2 @class=bordered");
$doc->alter();
```
## Rendering Templates
## Appending to Templates
Use the array append syntax (`$template[] =`) to append elements to
an existing element:
```
$t = fhtml();
$t[] = ["@h1" => "Hello World"];
```