waughj/html-tag

Simple class for generating HTML tag.

Installs: 51

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/waughj/html-tag

v0.1.0 2019-09-10 17:26 UTC

This package is auto-updated.

Last update: 2025-09-11 06:51:01 UTC


README

Simple class for generating HTML tag.

Use

This class's constructor takes 3 arguments, 2 of which are optional:

  1. The tag name (string)
  2. A list of attributes (associative array)
  3. Content (anything that can be converted into a string, including other HTMLTag instances)

Example

use WaughJ\HTMLTag\HTMLTag;

echo new HTMLTag
(
    'div',
    [ 'class' => 'main' ],
    new HTMLTag
    (
        'img',
        [ 'src' => 'image.gif' ]
    )
);

will generate:

<div class="main">
    <img src="image.gif" />
</div>

Changelog

0.1.0

  • Initial Release