HtmlBuilder
class HtmlBuilder (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from MacroableTrait |
protected UrlGenerator | $url | The URL generator instance. |
Methods
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Convert an HTML string to entities.
Convert entities to HTML characters.
Generate a link to a JavaScript file.
Generate a link to a CSS file.
Generate an HTML image element.
Generate a HTML link.
Generate a HTTPS HTML link.
Generate a HTML link to an asset.
Generate a HTTPS HTML link to an asset.
Generate a HTML link to a named route.
Generate a HTML link to a controller action.
Generate a HTML link to an email address.
Obfuscate an e-mail address to prevent spam-bots from sniffing it.
Generate an ordered list of items.
Generate an un-ordered list of items.
Create a listing HTML element.
Create the HTML for a listing element.
Create the HTML for a nested listing attribute.
Build an HTML attribute string from an array.
Build a single attribute element.
Obfuscate a string to prevent spam-bots from sniffing it.
Details
static void
macro(string $name, callable $macro)
Register a custom macro.
static bool
hasMacro(string $name)
Checks if macro is registered
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
void
__construct(UrlGenerator $url = null)
Create a new HTML builder instance.
string
entities(string $value)
Convert an HTML string to entities.
string
decode(string $value)
Convert entities to HTML characters.
string
script(string $url, array $attributes = array(), bool $secure = null)
Generate a link to a JavaScript file.
string
style(string $url, array $attributes = array(), bool $secure = null)
Generate a link to a CSS file.
string
image(string $url, string $alt = null, array $attributes = array(), bool $secure = null)
Generate an HTML image element.
string
link(string $url, string $title = null, array $attributes = array(), bool $secure = null)
Generate a HTML link.
string
secureLink(string $url, string $title = null, array $attributes = array())
Generate a HTTPS HTML link.
string
linkAsset(string $url, string $title = null, array $attributes = array(), bool $secure = null)
Generate a HTML link to an asset.
string
linkSecureAsset(string $url, string $title = null, array $attributes = array())
Generate a HTTPS HTML link to an asset.
string
linkRoute(string $name, string $title = null, array $parameters = array(), array $attributes = array())
Generate a HTML link to a named route.
string
linkAction(string $action, string $title = null, array $parameters = array(), array $attributes = array())
Generate a HTML link to a controller action.
string
mailto(string $email, string $title = null, array $attributes = array())
Generate a HTML link to an email address.
string
email(string $email)
Obfuscate an e-mail address to prevent spam-bots from sniffing it.
string
ol(array $list, array $attributes = array())
Generate an ordered list of items.
string
ul(array $list, array $attributes = array())
Generate an un-ordered list of items.
protected string
listing(string $type, array $list, array $attributes = array())
Create a listing HTML element.
protected string
listingElement(mixed $key, string $type, string $value)
Create the HTML for a listing element.
protected string
nestedListing(mixed $key, string $type, string $value)
Create the HTML for a nested listing attribute.
string
attributes(array $attributes)
Build an HTML attribute string from an array.
protected string
attributeElement(string $key, string $value)
Build a single attribute element.
string
obfuscate(string $value)
Obfuscate a string to prevent spam-bots from sniffing it.