rdmtr/phpemmet

There is no license information available for the latest version (v1.0) of this package.

PHP implementation of emmet.io DOM elements generator

v1.0 2019-06-01 19:07 UTC

This package is auto-updated.

Last update: 2024-09-29 05:21:57 UTC


README

codecov.io Build Status

Usage

PHPEmmet generate DOM elements using emmet.io abbreviation syntax.

For example:

$html = Emmet::new()->make('(header>div*2)+footer>p')->saveHtml();
<header>
    <div></div>
    <div></div>
</header>
<footer>
    <p></p>
</footer>

Or you can use existing DomElement to add children to it:

$doc = new \DOMDocument();
$elem = $doc->createElement('body');
$doc->appendChild($elem);

$html = $this->emmet->make('(header>div*2)+footer>p', $elem)->saveHTML();
<body>
    <header>
        <div></div>
        <div></div>
    </header>
    <footer>
        <p></p>
    </footer>
</body>

Supported Aggregators

>, ^, +, *

Used for chainable tree building. Defines child, parent and sibling elements relations.

Supported Modificators

.class#id{content}[data-attr data-test=test]

Defines modification of current element: multiplication and elements descriptions (attributes, content etc.).