https://github.com/arxcode40/html5-php
Generate HTML5 element using PHP
https://github.com/arxcode40/html5-php
html html5 php
Last synced: 11 months ago
JSON representation
Generate HTML5 element using PHP
- Host: GitHub
- URL: https://github.com/arxcode40/html5-php
- Owner: arxcode40
- License: mit
- Created: 2025-01-27T07:02:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-29T08:05:00.000Z (about 1 year ago)
- Last Synced: 2025-01-29T08:35:21.251Z (about 1 year ago)
- Topics: html, html5, php
- Language: PHP
- Homepage:
- Size: 1000 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTML5 PHP
## Description
Helper for generate HTML5 element.
## Syntax
```php
html5(
string $tag = 'doctype',
array $attributes = [],
mixed ...$children
): string
```
## Parameters
#### tag
The HTML5 tag.
#### attributes
The HTML5 attributes.
#### children
The HTML5 children.
## Return Values
Return the HTML5 element.
## Examples
**Example #1: Basic example**
```php
echo html5('div', ['class' => 'row'],
html5('div', ['class' => ['col-sm-8', 'col-md-6']], '')
);
```
```html
```
**Example #2: Doctype declaration**
```php
echo html5();
```
```html
```
**Example #3: Multiple children**
```php
echo html5('ul', [],
html5('li', [], ''),
html5('li', [], '')
);
```
```html
```
**Example #4: Self-closing tags**
```php
echo html5('input', [
'required' => true,
'style' => [
'display' => 'block'
],
'type' => 'text'
]);
```
```html
```