Download the PHP package alius/tag without Composer
On this page you can find all versions of the php package alius/tag. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tag
Alius Tag
It's just a simple class to create tags.
Basic usage
Use the render method or cast the class to string to get the html.
Methods
Attributes
object attr ( string $name, mixed $value = null )
Change the attribute. Chainable.
Preserves the original php type:
Html entities and double quotes are converted (only when rendered):
mixed getAttr ( string $name )
Get the attribute value.
bool hasAttr ( string $name )
True if the attribute exists. Even if it's empty.
object deleteAttr ( string $name )
Delete the attribute. Chainable.
string renderAttr ( string $name )
Get the attributes in string.
Content
object add ( mixed $value )
Add content. Chainable. The value is converted to string, null or empty string is skipped.
object setContent ( mixed $value )
Replaces the content. Chainable.
bool hasContent
True if there is some content.
object deleteContent
Delete the content. Chainable.
string renderContent
Get the content string.
Class
Helper methods for classes.
object addClass ( $values )
Add class(es). Chainable. Null and empty string skipped. You can pass an array or string. Don't worry about whitespaces.
object setClass ( $values )
Replace existing classes. Chainable. You can use it with the class pseudo method via __call:
array getClass ()
Get the classes.
bool hasClass ( $value )
True when the class is set.
object deleteClass ( $values )
Delete one class. Chainable. Deletes the class attribute when you delete the last class.
Data
Helper methods for data attributes.
object data ( $name, $value = null )
Set the data attribute. Chainable.
mixed getData ( $name )
Get the data value. Null if the data is not set.
bool hasData ( $name )
True if there is a data attribute with this name, even if it's empty.
object deleteData ( $name )
Delete the attribute.
Other
Non-existing methods are treated as attributes using the __call method:
You can use this class statically:
There is a general factory:
object make ( string $tag )
And there are some useful helper factories:
object form ( string $action, $method = 'post', $token = null )
If the form isn't get or post we change the method to post and add a _method hidden tag:
If you set the token we place a _token hidden tag:
object labelFor ( mixed $for, string $text = null )
You can add string or even an other tag:
object select ( string $name, array $options = [] )
Use it with option tags: