rdmtr / phpemmet
PHP implementation of emmet.io DOM elements generator
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/rdmtr/phpemmet
Requires
- php: ^7.2
- ext-dom: *
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2025-12-29 02:59:37 UTC
README
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.).