hadleen / htmldom
Lightweight enhancement layer for PHP DOMDocument and DOMElement.
dev-main
2025-12-03 20:35 UTC
Requires
- php: >=8.0
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.5
This package is not auto-updated.
Last update: 2026-01-01 13:46:31 UTC
README
hadleen/htmldom is a lightweight enhancement layer over PHP’s built-in DOMDocument and DOMElement.
It provides:
- HtmlDOM — an extended DOMDocument with automatic registration of HtmlElement
- HtmlElement — an extended DOMElement offering:
- HTML fragment insertion (
insertById,insertByName,insertByTagName,insertByAttribute) - content manipulation (
appendContent,prependContent) - DOM querying shortcuts
- reading & modifying HTML with
innerHTML()andouterHTML() - safe HTML fragment importing with automatic wrapper unwrapping
- HTML fragment insertion (
This library is intentionally small, dependency-free, and designed for general-purpose PHP applications needing robust DOM utilities.
Installation
composer require hadleen/htmldom