24hoursmedia/php-dom-manipulations
Lightweight PHP helpers for manipulating HTML DOM documents. Create, find, update, replace, and remove nodes and attributes with a simple API suited for scraping, templating, and HTML cleanup tasks in legacy or modern PHP projects.
DOMDocument operations (e.g., XPath queries, node traversal, attribute manipulation). It fits well in systems requiring server-side HTML parsing, scraping, or dynamic DOM generation (e.g., headless browsers, PDF-to-HTML conversion, or legacy web scraping pipelines).DOMDocument support (via str_get_html() or Symfony\Component\DomCrawler) may overlap, but this package could offer domain-specific shortcuts (e.g., bulk node updates, CSS selector-like queries) if tailored to a niche workflow (e.g., e-commerce product scraping, form processing).HtmlProcessorService for DOM transformations).ext-dom or libxml).DOMDocument::clear() calls).Symfony/DomCrawler, FilamentPHP/Html) or modern alternatives like spatie/html?symfony/dom) suffice.spatie/html (modern, actively maintained).symfony/dom-crawler (bundled with Laravel).masterminds/html5 (HTML5-aware parser).Symfony/DomCrawler for performance.composer require 24hoursmedia/php-dom-manipulations.app/Services/DomManipulator) for easy swapping later.spatie/html.ext-dom (enabled by default in PHP).DOMDocument usages with package methods.composer.json to avoid accidental updates.ext-dom and libxml for security advisories.DOMDocument::clear() or DOMNode::release().max_execution_time).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| PHP 8.x upgrade breaks compatibility | App crashes or silent failures | Fork/replace with spatie/html |
| Malformed HTML crashes parser | 500 errors in production | Add input validation (e.g., filter_var) |
| Memory exhaustion on large files | Worker timeouts or OOM kills | Stream processing or chunking |
Security vulnerability in ext-dom |
XSS or SSRF in parsed content | Sanitize output (e.g., htmlspecialchars) |
| Package abandonment | No future fixes | Document replacement plan early |
DOMDocument.How can I help you explore Laravel packages today?