theseer/fdomdocument
Archived PHP library extending DOMDocument to throw exceptions instead of warnings/notices, plus handy shortcuts like XPath query helpers and appendElement variants. Drop-in replacement for DOM with libxml support; works with PHP 5.3.3–8.1 (v1.6.7).
DOMDocument with exception-based error handling and convenience methods, making it a strong fit for Laravel applications heavily reliant on DOM manipulation (e.g., XML/HTML parsing, dynamic document generation, or web scraping). The API compatibility ensures minimal disruption to existing codebases.fDOMException objects, aligning with Laravel’s logging and error-handling practices (e.g., Monolog, Sentry). This is particularly valuable for production environments where warnings suppressions are undesirable.queryOne(), select() (CSS selectors), and appendElement*(), which can reduce boilerplate in Laravel’s templating, report generation, or data transformation layers. The XPathQuery helper also mitigates XPath injection risks.DOMDocument without modifying Laravel’s core or third-party dependencies, reducing integration risks. It can be adopted incrementally (e.g., per-service or module)."theseer/fdomdocument": "^1.6") with no additional tooling or configuration. Autoloading is handled via Composer.__toString support simplifies output handling.DOMDocument to fDOMDocument) or used selectively in services.libxml) may introduce vulnerabilities if unpatched.try-catch blocks for DOM operations may need updates to handle fDOMException (though it extends \Exception).App\Exceptions\Handler) may impact performance in high-volume DOM operations.#[ReturnTypeWillChange] attributes (used as a workaround).symfony/dom-crawler or php-html-parser may interact unpredictably if they also extend DOMDocument.fDOMDocument?How can I help you explore Laravel packages today?