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

Zend Xml2Json Laravel Package

zendframework/zend-xml2json

Converts XML to JSON using PHP's DOM and JSON extensions, letting you transform XML documents or strings into JSON output ready for APIs, storage, or JavaScript consumption.

Deep Wiki
Context7

Technical Evaluation

What the package actually is. zendframework/zend-xml2json is a narrow utility from the Zend Framework ecosystem: a small Xml2Json class plus a console binary that converts an XML document into a JSON string (attributes, nested elements, and text nodes mapped by convention). It is not a Laravel package, not a service provider, and not an integration layer — it is a single-purpose converter with one runtime dependency on the Zend XML component (and through it, the Zend DOM/entity-loading surface).

Architecture fit. Poor for a Laravel application as a long-lived dependency. Laravel's XML handling conventions (Symfony Serializer/DomCrawler, SimpleXMLElement, or spatie/array-to-xml for the inverse direction) already cover this need, and those are maintained under active release cadences. Introducing an archived Zend-namespaced package means a second, unmaintained XML abstraction living beside Symfony's — two competing DOM/entity configurations in one process, which is exactly the kind of duplication that creates inconsistent XXE posture across code paths.

Integration feasibility. Mechanically trivial — composer require and a new Xml2Json() call — but the low value density is the point. Composer's abandoned flag will surface a warning on every install and update, which is a governance problem for a TPM owning supply-chain hygiene: it trains teams to ignore abandonment warnings. The package also predates PHP 8 in its release line (last tag 2019-10-16), so its dependency constraints on zendframework/zend-xml 2.x almost certainly conflict with a modern Laravel 10/11 stack running PHP 8.2+. Whether it installs at all depends on Composer resolving to an unmaintained transitive branch.

Technical risk. Four material risks:

  1. Unpatched attack surface. XML parsing is a classic XXE and entity-expansion target. An archived package receives no security advisories and is outside the scope of composer audit / GitHub Advisory coverage. Any libxml entity-handling hardening added upstream post-2019 is not available to you.
  2. Lossy semantics. The XML→JSON mapping is convention-based and lossy: attribute-vs-element collisions, repeated siblings collapsing to arrays only sometimes, mixed content, CDATA, and namespace prefixes are all handled by heuristic. Downstream consumers cannot tell whether data was absent or merely reshaped.
  3. Unbounded in-memory conversion. The converter materializes a full DOM and a full JSON string. Contract feeds, SOAP payloads, and partner EDI exports routinely arrive at tens of megabytes, which is a per-worker memory ceiling and an OOM vector under queue concurrency.
  4. Zero maintainership. Nobody is on the hook for a bug. "Repo unknown" and 15 stars mean no meaningful community backstop and no realistic path to upstreaming a fix.

Key questions to resolve before any commitment.

  • Is there an actual requirement to preserve this specific JSON shape, or is the real requirement "consume partner XML"? If the latter, this package is the wrong tool entirely.
  • Does the XML source contain namespaces, mixed content, or attributes with siblings of the same name? If yes, the mapping is unreliable and will produce silent data corruption rather than errors.
  • Does the source ever exceed a few megabytes, or arrive from an untrusted party? If yes, the memory and XXE risks move from theoretical to blocking.
  • Is the migration target laminas/laminas-xml2json acceptable, or is the correct move to delete the dependency and use Symfony's serializer behind a domain DTO?
  • Who signs off on an exception to the "no archived dependencies" policy, and what is the exit date?

Position. For a TPM, this is a reject-as-new-dependency candidate (score 0.2225 is directionally correct). The only defensible use is a short-lived, isolated bridge in a legacy migration — never in a new greenfield service, and never on a path that touches untrusted XML.

Integration Approach

Stack fit. Effectively none. There is no Laravel service provider, no config surface, no facade, no publishable assets, and no queue/event awareness. Wiring it in means writing an application-level adapter — at which point you are building the integration yourself, and the package contributes only the mapping heuristic. The dependency footprint it drags in (zendframework/zend-xml) is itself archived and superseded by laminas/laminas-xml.

Recommended target architecture. Do not adopt the package. Instead:

  • Parse with XMLReader for streaming or Symfony DomCrawler/Serializer for bounded documents, with libxml_disable_entity_loader semantics handled explicitly (LIBXML_NONET, no LIBXML_NOENT) or, on PHP 8+, entity loading disabled by default — but state this in code, not in assumption.
  • Map XML into an explicit DTO or array shape defined by your domain, not by a generic convention. This is the single highest-value change: it converts silent shape drift into a typed failure at the boundary.
  • Encode with json_encode(..., JSON_THROW_ON_ERROR) so malformed UTF-8 and depth violations surface as exceptions rather than false.

If the legacy shape must be preserved byte-for-byte. Use laminas/laminas-xml2json — the maintained continuation of the same codebase, same API, same mapping conventions — pinned to a version with a PHP 8.x constraint, and wrapped in a single adapter class behind an interface. That gives you a one-file swap when you retire it. Verify the constraint resolution in a throwaway branch before committing to the plan; do not assume the fork's PHP support matches your runtime.

Migration path. Sequenced in four steps:

  1. Inventory. Grep the codebase and composer.lock for zendframework/* and confirm whether other Zend packages are already present (a common legacy signature). Bundle the remediation if so.
  2. Characterize. Run a fixture corpus of real production XML — including namespace-heavy, mixed-content, and large samples — through both the old converter and the proposed replacement. Diff the JSON. Any diff is a scoping decision, not a bug to paper over.
  3. Replace behind an interface. Introduce XmlToJsonConverter as a domain port with the current implementation as the first adapter, so step 4 is a container binding change, not a refactor.
  4. Remove. Drop the dependency, run composer audit, and add a CI check that fails on abandoned packages to prevent the next one.

Compatibility notes. Expect friction at the Composer level rather than the code level: PHP 8.2+ runtime against a 2019-era constraint set, plus potential overlap with symfony/serializer's bundled XML handling. Validate on a branch with the full test suite and a production-shaped XML corpus, not with composer require --dry-run alone.

Operational Impact

Maintenance. The dominant cost. An archived package has no upgrade path, no CVE response, and no compatibility guarantees with future PHP or libxml releases. It is a permanent, silent liability on the dependency register, and the effort to remove it only grows with time as more code accretes around its output shape. The "maintenance saving" of reusing an existing converter is illusory — you pay it back at the removal, with interest.

Support. No maintainer, no issue tracker in scope, no vendor. Internal support is the only support, which means an on-call engineer debugging a JSON mapping anomaly with no upstream to escalate to. Budget for that in the ownership model: name a team, not a person.

Scaling. The converter is whole-document, not streaming. Memory scales with document size times queue concurrency, so throughput is bounded by the largest payload, not by CPU. For batch ingestion (nightly partner feeds, S3 drop-and-process), this forces either a hard payload size cap, a dedicated low-concurrency queue, or a rewrite to streaming. Model this explicitly with a worker memory limit and a documented maximum accepted document size — otherwise the first oversized file becomes a production incident.

Failure modes to instrument.

  • Silent shape drift — attributes promoted to keys, single-element arrays flattening to scalars when a second sibling appears later. Highest-severity, lowest-visibility. Mitigate with contract tests on a recorded fixture corpus and schema validation before conversion.
  • XXE / entity expansion — a malicious or compromised upstream document leading to file disclosure or memory exhaustion. Mitigate by rejecting DTDs outright and never enabling entity substitution.
  • OOM under concurrency — mitigate with payload size limits, queue isolation, and memory-limit alarms.
  • Encoding faults — invalid UTF-8 producing false from json_encode and a downstream empty payload. Mitigate with JSON_THROW_ON_ERROR and alerting on converter exceptions, not just on HTTP 5xx.
  • Install-time breakage — a future composer update failing or, worse, resolving a stale transitive branch. Mitigate by pinning and by the abandoned-package CI gate.

Ramp-up. Near zero — the API is one class and one method, so a mid-level engineer is productive in an hour. That low ramp-up is precisely what makes the package attractive in a deadline and what makes it dangerous: the cost is entirely deferred, and the people who made the adoption decision will have moved on before it lands. For a TPM, that asymmetry — cheap now, expensive later, invisible in the middle — is the argument for spending the extra week on a typed DTO boundary today.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle