Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Xml Core Laravel Package

andrey-helldar/xml-core

A lightweight PHP library providing core XML utilities, serving as a shared foundation for Helldar's XML-related packages. Keeps common XML handling logic simple and reusable across PHP and Laravel projects.

View on GitHub
Deep Wiki
Context7

XML Core is a lightweight PHP package that provides foundational utilities for working with XML. It offers a straightforward API for converting arrays into XML and parsing XML back into arrays, making it useful for XML-based data exchange and integration in PHP applications.

  • Array-to-XML conversion for generating structured XML documents.
  • XML-to-array parsing for convenient data access.
  • Simple, dependency-light API suitable for small projects and package foundations.
  • Reusable core utilities for building XML-related tooling.
Frequently asked questions about Xml Core
How do I install andrey-helldar/xml-core with Composer?
Install it with composer require andrey-helldar/xml-core, which pulls it in as a normal Composer dependency. It requires no manual bootstrapping, and in Laravel the package is discovered automatically where a service provider is present. After installing, run your existing test suite to confirm nothing in your current XML handling conflicts with it.
Does xml-core support Laravel 12?
Yes. Release 2.4.0 is a compatibility release that widens the framework constraint to include Laravel 12. Because the release only relaxed the constraint, no application-side code changes should be needed beyond a composer update. Still run your own regression tests before merging, and confirm that any related andrey-helldar packages you use also declare Laravel 12 support.
Can I use xml-core outside of Laravel in a plain PHP project?
Yes. The package is framework-agnostic and works as a standalone Composer dependency in any PHP codebase. The Laravel-specific parts are just the version constraint and package auto-discovery; the parsing and conversion utilities themselves do not depend on the framework. That makes it usable in CLI tools, legacy applications, and services that are not built on Laravel.
How do I convert an XML string into a PHP array?
The package provides parsing helpers that read an XML document and return a plain PHP array you can iterate over. Typical usage is to pass the raw XML string or a file path to the parser and then work with the resulting array structure. Because the output is a normal array, you can feed it directly into validation, mapping, or database writes. Check the README for the exact method signature in the version you install.
How do I generate an XML document from a PHP array?
xml-core handles the reverse direction too, turning a nested PHP array into a well-formed XML document. You build the array in the shape you want the document to take, pass it to the conversion helper, and receive the XML string back. This is handy for SOAP payloads, feeds, and export files without hand-writing string concatenation. Always validate the generated output against the schema your consumer expects.
What are the requirements and dependencies of xml-core?
The package is intentionally lightweight and describes itself as a dependency-free foundation, so it will not drag a large tree of third-party libraries into your project. You will still need the standard PHP XML extensions available wherever DOM or SimpleXML is used, which are enabled in most PHP builds by default. Check the composer.json in the repository for the exact PHP version constraint before installing on older runtimes.
Does xml-core handle XML attributes, namespaces, and CDATA sections?
Core parsers of this kind typically place attributes and child nodes inside the resulting array structure, and namespace-qualified elements are returned with their qualified names so you can tell them apart. CDATA content is read back as plain text. Because flattening XML into an array is inherently lossy for mixed content, test how your own documents map before relying on the output in production.
How should I test XML handling in a Laravel app that uses xml-core?
Run your suite once before bumping the dependency, then again after the composer update to confirm there are no regressions. Keep fixture XML files representative of real payloads, including edge cases such as empty elements, attributes, and deeply nested nodes. If you are also upgrading Laravel, do the package bump and the framework upgrade in separate branches so a failure points to a single change. Assert on the parsed array output rather than on raw XML strings to keep tests stable.
Is xml-core actively maintained and safe to depend on in production?
The package is published on Packagist, follows standard Laravel package conventions, and its release history shows bot-driven maintenance such as license year refreshes and versioned changelog entries. Release 2.4.0 adding Laravel 12 support is a positive longevity signal because it shows the maintainer tracks Laravel's annual major release cadence. The main structural risk is that it is a single-maintainer project, so pin versions and keep XML handling behind your own abstraction if the dependency is business-critical.
What are the alternatives to xml-core for XML work in Laravel?
You can use PHP's built-in SimpleXML and DOM extensions directly, which are always available and add no dependency. Packages such as spatie/array-to-xml focus specifically on generating XML from arrays, while xml-core covers both reading and writing. Choose xml-core if you want one small, unified set of helpers; choose native extensions if you want zero third-party surface area. Whichever you pick, wrap it in your own service class so swapping later is cheap.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect