fetchleo/laravel-xml
fetchleo/laravel-xml brings simple XML handling to Laravel: parse XML strings or files into arrays and collections, and generate clean XML from models or arrays with an expressive API. Handy for feeds, sitemaps, SOAP APIs, and third-party integrations, with minimal configuration.
Adopt when:
XmlSerializer interface so the implementation is swappable.Look elsewhere when:
symfony/serializer, a SOAP client, or a domain-specific EDI library.XMLWriter) instead of building strings in memory.spatie/laravel-sitemap and spatie/laravel-feed already solve those with more care.spatie/array-to-xml is the better-known underlying option, and a hand-rolled helper is entirely defensible at this size.Adoption hygiene either way: pin the version, wrap it behind an interface, add your own tests around the output shape, and watch release cadence.
To executives: "We need XML output for [partner/export]. There's a small Laravel helper that gets us there in days rather than weeks, and it's low-risk to trial because it's tiny and easily replaced. It's a small community project, so I'd treat it as a time-boxed accelerator, not a strategic dependency — if XML becomes a bigger surface area, we'll consolidate on a maintained library or own the code. Cost to try: hours. Cost to back out: also hours."
To engineering: "It's a thin wrapper that turns arrays and values into XML strings — the domain logic stays ours. I'll wrap it in our own serializer interface so we can swap to spatie/array-to-xml or raw XMLWriter without touching call sites. It doesn't parse, validate, or stream, so don't reach for it for inbound XML or large exports. Caveats: single maintainer, 10 stars, thin release history — pin it and keep the fork option open. Integration estimate: hours; replacement estimate: hours."
How can I help you explore Laravel packages today?