veewee/xml
veewee/xml provides a type-safe, declarative API for working with XML in PHP, covering DOM, encoding, error handling, memory-safe readers and writers, XSD schemas, and XSLT. It handles errors for you and supports spec compliance on PHP 8.4+.
SimpleXML, DOMDocument) by combining security-focused configurators (disallow_doctype()) with faster in-memory writes and libxml issue detection. This means you no longer trade off security for speed, and you get built-in diagnostics that catch underlying libxml problems before they become incidents.libxml_disable_entity_loader()) to mitigate XXE vulnerabilities, now reinforced by native libxml issue detection.disallow_doctype() to CI/CD templates for XML generation pipelines to enforce security-by-default.disallow_doctype() requires PHP 8.2+)."This release builds on the recent security upgrade with two practical wins: it's faster at generating XML in memory, and it now detects underlying libxml issues so problems surface early instead of in production. Combined with the DOCTYPE blocking we adopted for XXE protection, this package is now both our security and performance answer for XML workloads — reducing risk in XML-heavy workflows like EDI or report generation while lowering per-request cost. It's a low-effort upgrade that improves both our security posture and our throughput."
*"New in 4.14.0: Faster in-memory writes and libxml issue detection, on top of the 4.12.0 security configurator. The disallow_doctype() configurator lets you disable DOCTYPE declarations during XML generation, which is a best practice for security. Use it like this:
$xml = Xml::element('root')
->configure(XmlConfig::disallow_doctype()) // Blocks DOCTYPE entirely
->addElement('item', ['id' => '123']);
Why it matters:
disallow_doctype() isn’t for you — but most modern apps don’t.*
Start by adding it to your API response builders or template renderers, and re-profile your hottest XML generation code paths against 4.14.0."*"This release introduces a security-hardened XML builder that addresses OWASP XML Security Risks (A03:2021), now paired with performance and reliability improvements (faster in-memory writes, libxml issue detection). Key architectural implications:
disallow_doctype() with existing measures (e.g., libxml_disable_entity_loader()) for layered protection, with libxml issue detection providing observability into the underlying parser layer.disallow_doctype() globally in your XML writer unless DOCTYPEs are explicitly required. For legacy systems, document the exception and monitor for XXE attempts. Re-benchmark high-volume XML generation on 4.14.0 and wire libxml issue detection into your observability stack.*"How can I help you explore Laravel packages today?