Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Extended Htmldocument Laravel Package

vardumper/extended-htmldocument

ExtendedHtmlDocument is a PHP library that extends DOMDocument with convenient helpers for loading, querying, and manipulating HTML. It reduces boilerplate for common DOM tasks, making it easier to find elements, traverse markup, and apply changes in scraping or transformation workflows.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Context of this release: 0.3.5 is a patch bump on a pre-1.0 package, and the release notes contain no substantive content — only an auto-generated compare/0.3.4...0.3.5 link. There is no changelog entry, no CVE reference, no migration note. This assessment is therefore based on the package's established shape and must be treated as provisional until the diff is reviewed by an engineer. Under SemVer, 0.x patch bumps are explicitly permitted to carry breaking changes, so the low version number is not evidence of low risk.

Architecture fit

  • vardumper/extended-htmldocument is a standalone PHP library, not a Laravel package. It ships no service provider, no facade, no config file, and no publishable assets. It will not appear in config/app.php providers and will not be discoverable via package auto-discovery.
  • Its purpose is narrow: an ExtendedHtmlDocument that subclasses/extended DOMDocument to provide more forgiving, HTML5-style parsing and additional traversal helpers on top of ext-dom (typically via masterminds/html5). It fits applications doing server-side HTML ingestion — scraping, email/HTML sanitization, CMS content transformation, third-party markup normalization, snapshot testing of rendered views.
  • It does not fit as a general templating or rendering layer, and it is not a substitute for symfony/dom-crawler as a query API. If the team's need is "query HTML with CSS selectors," DomCrawler is the better-shaped dependency.
  • Strategic caveat: PHP 8.4 introduced the native \Dom\HTMLDocument (HTML5-compliant parser) in core. Much of this package's differentiation is being absorbed by the language runtime. Any adoption decision should be framed as a bridge with a defined exit, not a long-term foundation.

Integration feasibility

  • Low mechanical effort: composer require vardumper/extended-htmldocument:^0.3.5. No bootstrapping required.
  • Real effort sits in dependency reconciliation. The package almost certainly constrains masterminds/html5 and ext-dom; symfony/dom-crawler (Laravel-adjacent, Drupal-adjacent) constrains the same transitive dependency. Expect constraint conflicts on older Laravel/Drupal majors.
  • Requires ext-dom and ext-libxml in the runtime image. Common php:*-alpine builds omit or partially ship these; container base images must be verified before the Composer install is trusted.
  • No framework integration surface means no framework-level upgrade risk — the package cannot break artisan, the container, or the HTTP kernel. Blast radius is confined to call sites.

Technical risk

  • Change opacity (primary risk). A patch release with no notes on a 0.x line means the diff is the only source of truth. Until reviewed, treat 0.3.5 as behaviorally unknown.
  • DOMDocument subclassing. Extending a libxml-backed internal class couples the code to libxml global state (libxml_use_internal_errors), non-obvious memory behavior, and PHP's evolving handling of dynamic properties on internal classes (deprecations from 8.2 onward).
  • Parser divergence. HTML5 parsing differs from libxml's HTML parser in error recovery, implied tags, and encoding detection. Switching a call site between the two can silently change output on malformed markup — a correctness risk that unit tests on well-formed fixtures will not catch.
  • Security surface. Any parser that expands entities or resolves external resources needs explicit review. Confirm LIBXML_NOENT / network access are not enabled at call sites, and that the package does not alter libxml defaults.
  • Bus factor / governance. Small-maintainer, single-purpose library with no visible security policy or LTS commitment.

Key questions for the maintainer / engineering spike

  1. What is the actual diff in 0.3.4 → 0.3.5, and does it touch parsing behavior, public API, or only internal cleanup/CI?
  2. What are the declared php, ext-*, and masterminds/html5 constraints, and do they resolve cleanly against our current composer.lock?
  3. Is the public API considered stable within 0.3.x, and is a 1.0 planned?
  4. What is the test suite's coverage of malformed/edge-case HTML and non-UTF-8 encodings?
  5. Is there a documented migration path to \Dom\HTMLDocument on PHP 8.4+, and does the package already delegate to it?

Integration Approach

Stack fit

  • Framework-agnostic and framework-safe: it can be introduced into a Laravel 9/10/11 application without touching the container, providers, or middleware. Value is realized only inside services/jobs that parse HTML.
  • Best fit: queued ingestion jobs (scraping, import, sanitization) where parsing is already isolated and failure is retryable.
  • Poor fit: request-path parsing of untrusted, unbounded documents; anywhere a CSS-selector query API is the actual requirement.

Migration path

  • Do not replace DOMDocument instantiation directly at call sites. Introduce a thin internal interface (e.g. HtmlDocumentParser) with a parse(string): Document contract, and implement it with the package. This makes the dependency swappable for native \Dom\HTMLDocument (PHP 8.4+) or symfony/dom-crawler without a second migration.
  • Where symfony/dom-crawler already exists in the tree, first evaluate whether its bundled HTML5 support covers the need — that avoids adding a second parser dependency entirely.

Compatibility

  • Verify constraint resolution in a throwaway branch against the real composer.lock: composer require --dry-run vardumper/extended-htmldocument:^0.3.5.
  • Confirm runtime image has ext-dom/ext-libxml; confirm CI matrix covers the PHP versions actually deployed.
  • Watch for dual-parser coexistence: if both libxml's HTML parser and this package are used in one codebase, output will diverge across code paths. Standardize on one per domain.

Sequencing

  1. Diff review (blocking). Engineer reads the 0.3.4→0.3.5 compare diff, classifies as behavior-neutral vs. behavioral, and writes an internal changelog note. Do not proceed on release notes alone.
  2. Dependency dry-run against the production lockfile; resolve or reject constraint conflicts before any code work.
  3. Adapter + spike behind the internal interface, in one bounded ingestion path.
  4. Characterization tests. Golden-file tests over a fixture corpus that deliberately includes malformed markup, unclosed tags, mixed encodings, and very large documents — compare old vs. new parser output and review every diff.
  5. Staged rollout behind a config flag on a single non-critical job; monitor memory and failure rates before broadening.

Operational Impact

Maintenance

  • Low-ceremony dependency: no framework coupling means framework upgrades are unaffected.
  • The real maintenance cost is vigilance. Auto-generated release notes mean the team cannot triage updates from the release feed; every bump on the 0.x line requires a manual diff read. Budget a recurring task for this rather than assuming routine composer update safety.
  • Pin the version (^0.3.5 at minimum, exact pin preferred on a 0.x line) and treat upgrades as reviewed changes, not background noise.

Support

  • Community-supported only. No vendor SLA, no LTS branch, no visible security disclosure process. Acceptable for internal tooling; a governance question if it lands in a customer-facing or regulated path.
  • Mitigation is architectural, not contractual: the adapter interface means abandonment costs one implementation swap, not a rewrite.
  • Single-maintainer concentration is the standing continuity risk; document the fallback (native PHP 8.4 parser, or DomCrawler) in the ADR so it is executable without rediscovery.

Scaling

  • Parsing is in-process and CPU-bound; DOM trees are memory-heavy relative to source size (commonly several multiples of the input). Throughput is bounded by worker memory, not by any package-level concern.
  • Enforce a max document size and a parse timeout at the call site. This is not optional for untrusted input — it is the primary defense against memory exhaustion.
  • Scale horizontally via queue workers as usual; the package introduces no shared state, no external service, and no I/O, so it adds no new scaling dimension.

Failure modes

  • Silent semantic drift — malformed markup parses "successfully" but to a different tree than the previous parser, corrupting downstream output without an error. Highest-severity, lowest-visibility failure; mitigated only by characterization tests.
  • Encoding mishandling — non-UTF-8 or mislabeled charsets producing mojibake or dropped content.
  • Memory exhaustion — large or adversarial documents terminating the worker; manifests as OOM kills rather than catchable exceptions.
  • libxml global-state leakage — libxml_use_internal_errors set by one call site changing behavior in another; wrap parsing in try/finally that restores prior state.
  • Dependency resolution breakage — a future masterminds/html5 bump conflicting with DomCrawler, discovered at composer update time.
  • Silent abandonment — package goes unmaintained while still in the tree; only the adapter boundary limits the cost.

Ramp-up

  • Low for any engineer comfortable with PHP's DOM API — the surface is standard DOMDocument methods plus conveniences.
  • The non-obvious learning is the behavioral difference between libxml and HTML5 parsing, which is exactly where defects originate. Pair the spike with a short written note in the ADR capturing observed divergences, so the next engineer inherits the knowledge rather than re-deriving it.
  • Estimated effort: half a day for the spike and diff review, one to two days for adapter, fixture corpus, and characterization tests.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package