mtownsend/request-xml
Adds simple XML response parsing to Laravel's HTTP client. Call xml() on responses to convert XML into arrays, making XML APIs as easy to work with as JSON. Lightweight and Laravel-friendly for legacy or SOAP-style endpoints.
$request->xml() behave like Laravel's native $request->json(), so a team can accept an XML payload in a controller and ship the integration rather than building and maintaining its own parser, middleware, or DTO pipeline.^2.6 should plan the bump as part of the upgrade, not after it.Adopt when:
simplexml_load_string in every controller and want one place to enforce safe parsing defaults (external entity loading disabled, error handling consistent).^2.7 on Laravel 13 stacks; ^2.6 remains valid on older framework versions but is the older line.Look elsewhere when:
phpro/soap-client) — this package will not carry that weight.spatie/laravel-data with a custom cast) rather than array conversion.XMLReader-based streaming is the right answer; DOM-based parsing of 100 MB uploads will not end well.For executives (one paragraph): We have a small, recurring need to accept XML payloads from partners whose systems predate modern JSON APIs. Rather than fund a bespoke parsing component, we can adopt a tiny MIT-licensed Laravel package that adds XML support to the framework's existing request object. It removes roughly the same amount of work per integration as we currently spend on bespoke parsing, carries no infrastructure cost, and is small enough to fork and own if the maintainer stops. Its latest release adds compatibility with the newest Laravel version, so it does not constrain our framework upgrade path. The decision is low-cost and reversible; the main governance action is pinning the version and recording it in our dependency inventory.
For engineering (summary): composer require mtownsend/request-xml (use ^2.7 for Laravel 13.x; 2.7.0 is a compatibility-only release with no API changes, new features, or deprecations), auto-discovered service provider, then $request->xml() yields a parsed structure analogous to $request->json(), with attribute/namespace handling as needed. Two caveats to own on our side: (1) confirm entity/external-resource loading is disabled in the parsing path before it touches untrusted input, and (2) XML has no implicit schema — validation is our responsibility, so add explicit rules per endpoint. Pin the version, vendor the source if the integration is business-critical, and treat upgrading as a deliberate step rather than following ^ automatically.
Decision requested: approve adoption as the standard inbound XML parser for the current integration set, with a dependency-register entry and a six-month maintenance review — or, if policy forbids new low-adoption dependencies, approve the equivalent in-house implementation as a smaller, safer alternative. The 2.7.0 release does not change the recommendation; it removes the "will it survive our next framework upgrade" objection from the discussion.
How can I help you explore Laravel packages today?