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

Json Decoder Laravel Package

karriere/json-decoder

JsonDecoder maps JSON into typed PHP objects, handling nested objects, arrays, scalar casting, required fields, and custom decoders. It turns API responses and config files into predictable, IDE-friendly classes for safer, cleaner PHP code.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Typed API integration strategy: Decide whether external JSON payloads—webhooks, partner APIs, internal service calls—should be modeled as explicit PHP DTOs rather than associative arrays. This package supports a lightweight “map JSON into classes” approach that improves IDE support, static analysis, and refactor safety.
  • Build vs. buy for serialization: Compare adopting this decoder against hand-written hydrators or larger serialization stacks such as Symfony Serializer, JMS Serializer, or Spatie Laravel Data. It is most defensible for narrow, well-bounded JSON contracts where a full serializer would be overkill.
  • Platform standardization and runtime coupling: Decide whether to standardize JSON-to-object decoding across integrations, and recognize that this decision is now coupled to the PHP runtime baseline. v5.1.0 supports PHP 8.2+ only (PHP 8.0/8.1 support was removed) and adds PHP 8.5 support. Adoption therefore implies—or must be reconciled with—the platform’s minimum PHP version. Given the package’s small ecosystem footprint and unclear license metadata, a PM should still prefer a pilot or an internal adapter rather than mandating it platform-wide.
  • Feature scoping and acceptance criteria: Define requirements around nested objects, arrays of objects, nullable fields, unknown fields, type coercion, and failure behavior. These details determine whether the package is sufficient or whether a richer mapping/validation layer is needed.
  • Risk and migration planning: Use the low adoption signals—140 stars, 0 dependents, license marked NOASSERTION—to justify an abstraction layer. The v5.1.0 release is a positive maintenance signal (active PHP-version tracking), but it also demonstrates that compatibility windows move: the package ships major-version breaking changes (dropping PHP 8.0/8.1) alongside minor-version additions. A PM can approve contained usage while preserving a migration path to a more established serializer if maintenance, security, or legal concerns emerge.
  • Upgrade and dependency governance: Treat this as a case study for version-pinning policy. Teams on PHP 8.0/8.1 cannot take v5.1.0 without a runtime upgrade; teams on pinned ^5.0 constraints must confirm which minors silently raise the PHP floor. Require an explicit constraint strategy (caret vs. exact pin) and a scheduled compatibility review rather than open-ended upgrades.
  • Delivery prioritization: For integrations where payload shape is the main complexity, adopting a decoder can reduce boilerplate and shorten delivery time. For workflows where validation, versioning, or schema generation dominates, prioritize a broader data-transfer-object or validation solution instead.

When to Consider This Package

Consider it when:

  • Your services run PHP 8.2 or newer (v5.1.0 dropped PHP 8.0/8.1). If you are still on PHP 8.0/8.1, either pin to an earlier major, defer adoption until the runtime upgrade ships, or treat adoption as incremental pressure to complete that upgrade.
  • You have a small-to-medium set of JSON payloads and want explicit PHP classes instead of array access.
  • The team is comfortable with PHP attributes/annotations or the package’s mapping conventions.
  • You want a lightweight Composer dependency and do not need a Laravel service provider, config layer, validation framework, or full serializer.
  • The integration can be isolated behind an adapter/interface, covered by tests, and treated as non-critical until proven.
  • Legal has reviewed the NOASSERTION license metadata and accepts the dependency risk.
  • The team accepts low community adoption—few stars and zero dependents—because the scope is narrow and the code is simple enough to replace.
  • You can commit to tracking the package’s supported PHP range as part of routine dependency hygiene; its support window has already shifted once within the v5 line.

Look elsewhere when:

  • You need validation, normalization, versioned schemas, polymorphic types, OpenAPI generation, or Laravel-native validation integration.
  • Your platform cannot yet meet the PHP 8.2 floor and a runtime upgrade is not on the near-term roadmap.
  • The package would become a platform-wide serialization standard; a more established ecosystem is safer.
  • The JSON parsing path is security-critical or handles untrusted, high-volume payloads.
  • You require clear licensing, active maintenance, and broad community support.
  • A mature alternative already exists in the stack: Spatie Laravel Data, Symfony Serializer, JMS Serializer, CuyZ/Valinor, or hand-written hydrators for very small contracts.

How to Pitch It (Stakeholders)

For executives: This is a lightweight way to reduce integration bugs by replacing untyped JSON arrays with explicit PHP objects. It can speed up delivery for API-heavy features, and the recent release shows the maintainer is actively tracking new PHP versions—a modest positive signal. However, that same release drops support for older PHP versions, so adoption must line up with our runtime upgrade plans, and it should still be piloted in a contained integration because of low adoption and unclear license metadata.

For engineering: The package maps JSON into PHP class objects and can be used inside Laravel services, jobs, or controllers, but it is not Laravel-aware. It will not replace validation, serialization, or schema tooling. Note the v5.1.0 compatibility change: PHP 8.2+ is now required (8.0/8.1 dropped) and PHP 8.5 is supported. Pin your constraint deliberately, verify the effective PHP floor before bumping, use it behind an adapter, test the mapping behavior, and avoid making it a platform-wide standard until a pilot proves value.

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.
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
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle