https://github.com/elusivecodes/fyrehtmlhelper
FyreHTMLHelper is a free, open-source HTML helper library for PHP.
https://github.com/elusivecodes/fyrehtmlhelper
html php
Last synced: 11 months ago
JSON representation
FyreHTMLHelper is a free, open-source HTML helper library for PHP.
- Host: GitHub
- URL: https://github.com/elusivecodes/fyrehtmlhelper
- Owner: elusivecodes
- License: mit
- Created: 2022-04-29T09:54:07.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-29T01:49:17.000Z (almost 2 years ago)
- Last Synced: 2024-09-06T20:17:02.093Z (almost 2 years ago)
- Topics: html, php
- Language: PHP
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FyreHTMLHelper
**FyreHTMLHelper** is a free, open-source HTML helper library for *PHP*.
## Table Of Contents
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)
## Installation
**Using Composer**
```
composer require fyre/htmlhelper
```
In PHP:
```php
use Fyre\Utility\HtmlHelper;
```
## Basic Usage
- `$config` is a [*Config*](https://github.com/elusivecodes/FyreConfig).
```php
$html = new HtmlHelper($config);
```
The default character set will be resolved from the "*App.charset*" key in the *Config*.
**Autoloading**
It is recommended to bind the *HtmlHelper* to the [*Container*](https://github.com/elusivecodes/FyreContainer) as a singleton.
```php
$container->singleton(HtmlHelper::class);
```
Any dependencies will be injected automatically when loading from the [*Container*](https://github.com/elusivecodes/FyreContainer).
```php
$html = $container->use(HtmlHelper::class);
```
## Methods
**Attributes**
Generate an attribute string.
- `$options` is an array containing the attributes.
```php
$attributes = $html->attributes($options);
```
**Escape**
Escape characters in a string for use in HTML.
- `$string` is the string to escape.
```php
$escaped = $html->escape($string);
```
**Get Charset**
Get the character set.
```php
$charset = $html->getCharset();
```
**Set Charset**
Set the character set.
- `$charset` is a string representing the character set.
```php
$html->setCharset($charset);
```