wa72/htmlpagedom
wa72/htmlpagedom is a PHP library that extends DOMDocument for easy HTML manipulation with jQuery-style methods and CSS selectors. Load HTML strings or files, then query and modify elements using familiar find, filter, addClass, attr, and append APIs, powered by Symfony CssSelector.
wa72/htmlpagedom is a Composer library that extends Symfony’s DomCrawler with jQuery-like DOM traversal/manipulation. It is not Laravel-native: no service provider, facade, config, or queue integration. That is acceptable for a utility library, but the TPM should treat it as an internal adapter-wrapped dependency rather than a framework feature. It fits Laravel services, jobs, commands, and content-transformation pipelines where server-side HTML parsing/manipulation is needed. v3.1.0 does not change this positioning — it reinforces it by tracking Symfony’s release cadence rather than adding framework features.composer require in a Laravel app, assuming compatibility with the app’s PHP, Laravel, and Symfony component versions. It pulls/requires Symfony dom-crawler and likely css-selector. Laravel’s HTTP client can fetch content, then the package can parse and manipulate the response body. The main integration work remains a thin application wrapper to isolate its API and to enforce sanitization/escaping before output. Note the version floor moved: v3.1.0 requires PHP ≥ 8.1, so apps on PHP 8.0 (Laravel 9 and earlier) are now excluded. That is a non-issue for Laravel 10–12, which already require PHP 8.1+.ext-dom/libxml guaranteed in production? What is the fallback if the package is abandoned or its release cadence lags a future Symfony major? Do we need HTML5-spec parsing rather than libxml behavior?HtmlDomTransformer adapter. Use Laravel’s HTTP client for fetching, the package for DOM manipulation, and Laravel/Blade escaping or a dedicated sanitizer before rendering. Avoid direct package calls scattered across controllers or Blade templates. It pairs naturally with existing Symfony Crawler usage but should not become a de facto framework standard without broader validation.DomCrawler or DOMDocument. v3.1.0 does not change this path or introduce migration work of its own.composer why-not and a clean-app composer update in both configurations before adopting. Confirm ext-dom and libxml availability in CI and production. Pin the package and Symfony DOM components to tested majors; because v3.1.0 raised its PHP floor in a minor release, treat upstream minors as potentially floor-breaking and rely on lockfile pinning plus CI to catch it. Re-run malformed-HTML fixtures, since selector behavior and serialization may differ across DomCrawler majors.ext-dom causes runtime failure; Symfony version conflicts can block upgrades — and v3.1.0 introduces a new variant, where a permissive constraint silently resolves to a release whose PHP floor or Symfony range does not match our runtime; selector mismatches may silently return empty results; unsanitized output can create XSS risk; remote fetching can introduce SSRF/timeouts; large documents can exhaust memory. Handle exceptions, validate selector results, sanitize output, set HTTP timeouts, and log parse failures with safe payload metadata. Add a CI check that fails on unexpected platform-requirement changes during dependency updates.How can I help you explore Laravel packages today?