PHP Class Collective\Html\HtmlBuilder

Inheritance: use trait Illuminate\Support\Traits\Macroable, use trait Collective\Html\Componentable
Show file Open project: laravelcollective/html Class Usage Examples

Protected Properties

Property Type Description
$url Illuminate\Contracts\Routing\UrlGenerator The URL generator instance.
$view Illuminate\Contracts\View\Factory The View Factory instance.

Public Methods

Method Description
__call ( string $method, array $parameters ) : Illuminate\Contracts\View\View | mixed Dynamically handle calls to the class.
__construct ( Illuminate\Contracts\Routing\UrlGenerator $url = null, Illuminate\Contracts\View\Factory $view ) Create a new HTML builder instance.
attributes ( array $attributes ) : string Build an HTML attribute string from an array.
componentCall ( )
decode ( string $value ) : string Convert entities to HTML characters.
dl ( array $list, array $attributes = [] ) : Illuminate\Support\HtmlString Generate a description list of items.
email ( string $email ) : string Obfuscate an e-mail address to prevent spam-bots from sniffing it.
entities ( string $value ) : string Convert an HTML string to entities.
favicon ( string $url, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString Generate a link to a Favicon file.
image ( string $url, string $alt = null, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString Generate an HTML image element.
link ( string $url, string $title = null, array $attributes = [], boolean $secure = null, boolean $escape = true ) : Illuminate\Support\HtmlString Generate a HTML link.
linkAction ( string $action, string $title = null, array $parameters = [], array $attributes = [] ) : Illuminate\Support\HtmlString Generate a HTML link to a controller action.
linkAsset ( string $url, string $title = null, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString Generate a HTML link to an asset.
linkRoute ( string $name, string $title = null, array $parameters = [], array $attributes = [] ) : Illuminate\Support\HtmlString Generate a HTML link to a named route.
linkSecureAsset ( string $url, string $title = null, array $attributes = [] ) : Illuminate\Support\HtmlString Generate a HTTPS HTML link to an asset.
macroCall ( )
mailto ( string $email, string $title = null, array $attributes = [], boolean $escape = true ) : Illuminate\Support\HtmlString Generate a HTML link to an email address.
meta ( string $name, string $content, array $attributes = [] ) : Illuminate\Support\HtmlString Generate a meta tag.
nbsp ( integer $num = 1 ) : string Generates non-breaking space entities based on number supplied.
obfuscate ( string $value ) : string Obfuscate a string to prevent spam-bots from sniffing it.
ol ( array $list, array $attributes = [] ) : Illuminate\Support\HtmlString | string Generate an ordered list of items.
script ( string $url, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString Generate a link to a JavaScript file.
secureLink ( string $url, string $title = null, array $attributes = [] ) : Illuminate\Support\HtmlString Generate a HTTPS HTML link.
style ( string $url, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString Generate a link to a CSS file.
tag ( string $tag, mixed $content, array $attributes = [] ) : Illuminate\Support\HtmlString Generate an html tag.
ul ( array $list, array $attributes = [] ) : Illuminate\Support\HtmlString | string Generate an un-ordered list of items.

Protected Methods

Method Description
attributeElement ( string $key, string $value ) : string Build a single attribute element.
listing ( string $type, array $list, array $attributes = [] ) : Illuminate\Support\HtmlString | string Create a listing HTML element.
listingElement ( mixed $key, string $type, mixed $value ) : string Create the HTML for a listing element.
nestedListing ( mixed $key, string $type, mixed $value ) : string Create the HTML for a nested listing attribute.
toHtmlString ( $html ) : Illuminate\Support\HtmlString Transform the string to an Html serializable object

Method Details

__call() public method

Dynamically handle calls to the class.
public __call ( string $method, array $parameters ) : Illuminate\Contracts\View\View | mixed
$method string
$parameters array
return Illuminate\Contracts\View\View | mixed

__construct() public method

Create a new HTML builder instance.
public __construct ( Illuminate\Contracts\Routing\UrlGenerator $url = null, Illuminate\Contracts\View\Factory $view )
$url Illuminate\Contracts\Routing\UrlGenerator
$view Illuminate\Contracts\View\Factory

attributeElement() protected method

Build a single attribute element.
protected attributeElement ( string $key, string $value ) : string
$key string
$value string
return string

attributes() public method

Build an HTML attribute string from an array.
public attributes ( array $attributes ) : string
$attributes array
return string

componentCall() public method

public componentCall ( )

decode() public method

Convert entities to HTML characters.
public decode ( string $value ) : string
$value string
return string

dl() public method

Generate a description list of items.
public dl ( array $list, array $attributes = [] ) : Illuminate\Support\HtmlString
$list array
$attributes array
return Illuminate\Support\HtmlString

email() public method

Obfuscate an e-mail address to prevent spam-bots from sniffing it.
public email ( string $email ) : string
$email string
return string

entities() public method

Convert an HTML string to entities.
public entities ( string $value ) : string
$value string
return string

favicon() public method

Generate a link to a Favicon file.
public favicon ( string $url, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString
$url string
$attributes array
$secure boolean
return Illuminate\Support\HtmlString

image() public method

Generate an HTML image element.
public image ( string $url, string $alt = null, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString
$url string
$alt string
$attributes array
$secure boolean
return Illuminate\Support\HtmlString

linkAction() public method

Generate a HTML link to a controller action.
public linkAction ( string $action, string $title = null, array $parameters = [], array $attributes = [] ) : Illuminate\Support\HtmlString
$action string
$title string
$parameters array
$attributes array
return Illuminate\Support\HtmlString

linkAsset() public method

Generate a HTML link to an asset.
public linkAsset ( string $url, string $title = null, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString
$url string
$title string
$attributes array
$secure boolean
return Illuminate\Support\HtmlString

linkRoute() public method

Generate a HTML link to a named route.
public linkRoute ( string $name, string $title = null, array $parameters = [], array $attributes = [] ) : Illuminate\Support\HtmlString
$name string
$title string
$parameters array
$attributes array
return Illuminate\Support\HtmlString

linkSecureAsset() public method

Generate a HTTPS HTML link to an asset.
public linkSecureAsset ( string $url, string $title = null, array $attributes = [] ) : Illuminate\Support\HtmlString
$url string
$title string
$attributes array
return Illuminate\Support\HtmlString

listing() protected method

Create a listing HTML element.
protected listing ( string $type, array $list, array $attributes = [] ) : Illuminate\Support\HtmlString | string
$type string
$list array
$attributes array
return Illuminate\Support\HtmlString | string

listingElement() protected method

Create the HTML for a listing element.
protected listingElement ( mixed $key, string $type, mixed $value ) : string
$key mixed
$type string
$value mixed
return string

macroCall() public method

public macroCall ( )

mailto() public method

Generate a HTML link to an email address.
public mailto ( string $email, string $title = null, array $attributes = [], boolean $escape = true ) : Illuminate\Support\HtmlString
$email string
$title string
$attributes array
$escape boolean
return Illuminate\Support\HtmlString

meta() public method

Generate a meta tag.
public meta ( string $name, string $content, array $attributes = [] ) : Illuminate\Support\HtmlString
$name string
$content string
$attributes array
return Illuminate\Support\HtmlString

nbsp() public method

Generates non-breaking space entities based on number supplied.
public nbsp ( integer $num = 1 ) : string
$num integer
return string

nestedListing() protected method

Create the HTML for a nested listing attribute.
protected nestedListing ( mixed $key, string $type, mixed $value ) : string
$key mixed
$type string
$value mixed
return string

obfuscate() public method

Obfuscate a string to prevent spam-bots from sniffing it.
public obfuscate ( string $value ) : string
$value string
return string

ol() public method

Generate an ordered list of items.
public ol ( array $list, array $attributes = [] ) : Illuminate\Support\HtmlString | string
$list array
$attributes array
return Illuminate\Support\HtmlString | string

script() public method

Generate a link to a JavaScript file.
public script ( string $url, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString
$url string
$attributes array
$secure boolean
return Illuminate\Support\HtmlString

style() public method

Generate a link to a CSS file.
public style ( string $url, array $attributes = [], boolean $secure = null ) : Illuminate\Support\HtmlString
$url string
$attributes array
$secure boolean
return Illuminate\Support\HtmlString

tag() public method

Generate an html tag.
public tag ( string $tag, mixed $content, array $attributes = [] ) : Illuminate\Support\HtmlString
$tag string
$content mixed
$attributes array
return Illuminate\Support\HtmlString

toHtmlString() protected method

Transform the string to an Html serializable object
protected toHtmlString ( $html ) : Illuminate\Support\HtmlString
$html
return Illuminate\Support\HtmlString

ul() public method

Generate an un-ordered list of items.
public ul ( array $list, array $attributes = [] ) : Illuminate\Support\HtmlString | string
$list array
$attributes array
return Illuminate\Support\HtmlString | string

Property Details

$url protected property

The URL generator instance.
protected UrlGenerator,Illuminate\Contracts\Routing $url
return Illuminate\Contracts\Routing\UrlGenerator

$view protected property

The View Factory instance.
protected Factory,Illuminate\Contracts\View $view
return Illuminate\Contracts\View\Factory