- How do I install dragon-code/xml-core in a Laravel project?
- Install it with Composer using composer require dragon-code/xml-core. The package is framework-agnostic and PSR-4 structured, so it works the same way inside a Laravel app or a standalone PHP project. If the package ships a Laravel service provider, check composer.json extra.laravel to confirm whether package discovery registers it automatically or whether you must add it to your providers list manually. No configuration file is documented as required for basic XML building.
- Does dragon-code/xml-core support Laravel 12 and PHP 8.3?
- The 2.4.0 release note states that Laravel 12 support was added, so the package is being released against a current framework version. What that means in practice is ambiguous: it could be a widened composer constraint, a Laravel service provider, or only an expanded CI test matrix, and the release note does not distinguish them. Inspect composer.json require and require-dev blocks plus any extra.laravel section to see the actual PHP and illuminate constraints before assuming your runtime is covered.
- What is the difference between dragon-code/xml-core and XMLWriter or symfony/xml?
- XMLWriter, symfony/xml, and sabre/xml are mature, widely used, heavily documented tools that sit closer to real Laravel problems such as sitemaps, RSS and Atom feeds, SOAP, and UBL invoicing. dragon-code/xml-core offers a fluent, object-oriented builder that avoids ext-DOM boilerplate and manual string concatenation, which is pleasant for small, well-formed documents. Before adopting it, ask what it does that XMLWriter plus a short builder wrapper, or symfony/xml, does not do for your specific output shape. Adoption signals are currently very low, so the documentation and community answers are thinner than the alternatives.
- How do I build a nested XML document with the fluent builder?
- The package exposes a fluent interface for composing elements, attributes, and nested child nodes, then renders the tree to a well-formed string. You create a root element, chain calls to append children and set attributes, and finally call the render or output method to get the XML. Because the API is object-oriented, repeated structures such as list items can be produced in loops and attached to a parent node. Check the repository source for the exact method names, since the README excerpt is not available here and the naming may differ between versions.
- Does dragon-code/xml-core support attributes, namespaces, and CDATA sections?
- Yes. The package description explicitly lists attributes, namespaces, and CDATA as supported features alongside the fluent builder. Namespace prefixes and CDATA blocks are the two areas where hand-rolled string concatenation most often produces invalid markup, so having them in the builder is a real advantage. Verify the exact namespace declaration syntax in the source, because prefix scoping rules are the easiest thing to get subtly wrong.
- Is dragon-code/xml-core safe for parsing untrusted XML input?
- The package is positioned primarily as an XML builder, and the overview describes constructing and rendering documents rather than parsing them; the short blurb mentions parsing and validating, which creates ambiguity. If you intend to parse untrusted input, confirm in the source that external entity loading and entity expansion are disabled, because active maintenance does not imply XXE hardening. Disabling libxml entity loading at the PHP level is a sensible belt-and-braces measure regardless. For untrusted input today, the better-documented alternatives are safer default choices.
- Can I extend dragon-code/xml-core with custom XML node types?
- The package advertises extensible base classes for custom XML node types, which lets you model recurring document shapes as dedicated classes instead of ad-hoc builder calls. That is useful when you generate several related formats, such as feeds or sitemaps, from a shared vocabulary. Subclassing ties you to the package internal API, so check how stable those base classes have been across the 2.x releases before committing to a deep hierarchy. With a single maintainer, internal refactors are a real possibility.
- Is dragon-code/xml-core actively maintained and safe to use in production?
- The project appears to have been unarchived, since a release cannot be published to a read-only repository, and a Laravel 12 compatibility release plus automated license and CI activity suggest the maintainer is active again. However, adoption is effectively nil: around two stars, no known dependents, and no evidence of use outside the author's own ecosystem. It is also a single-maintainer, single-organization package with no visible security policy or co-maintainer. Treat it as a low-risk convenience dependency rather than a critical path component, and verify the archive status and any SECURITY.md on the repository page yourself.
- Do I need to register a service provider or publish config for Laravel?
- Laravel support is described as optional, which usually means the core classes work without the framework and a service provider is only needed for container bindings or config merging. Whether that provider is auto-discovered depends on the extra.laravel block in composer.json. If auto-discovery is present, no manual registration is required; if not, add the provider to your bootstrap providers list. There is no documented requirement to publish configuration for basic XML generation.
- How should I test XML output generated by dragon-code/xml-core?
- Because the builder renders to a string, you can assert exact output with a string comparison in PHPUnit or Pest, but that is brittle when attribute order or whitespace changes between releases. A sturdier approach is to load the generated string with DOMDocument or SimpleXML and assert on the parsed structure, element counts, and attribute values. Cover the tricky cases explicitly: namespace prefixes, CDATA content, and characters that require escaping. Those are the areas where any XML builder, including this one, is most likely to regress.