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 Laravel Package

webmozart/json

A robust PHP library for decoding, encoding, and validating JSON. It provides clear error messages with line and column details, JSON Schema validation, and convenient file handling via JsonFile, making JSON processing safer and easier in PHP applications.

Deep Wiki
Context7

Product Decisions This Supports

  • API contract enforcement (build vs. buy): Informs whether to introduce a dedicated JSON Schema validation layer for inbound webhook payloads, partner integrations, or public API request bodies — versus relying on hand-rolled json_decode() checks or Laravel's Validator.
  • Data import/export roadmap: Schema-validated JSON is a prerequisite for features like bulk data import, config-file ingestion, or user-supplied JSON payloads (e.g., custom workflow definitions, dashboard configs). This package's decode-with-validation model lets you scope those features with a single library dependency instead of bespoke validation per surface.
  • Queue and event payload integrity: Supports a roadmap item around validating messages on queues, events, or third-party webhooks before they hit domain logic — reducing poison-message handling and incident load.
  • Schema-first product surface: Enables decisions about whether the product exposes JSON Schema to customers (e.g., "define your own validation rules") — a differentiator for platform/B2B products, but one that mandates a maintained validator.
  • Technical debt triage: If already present transitively (common in older Symfony/webmozart stacks), this informs whether to formally adopt, pin, or schedule removal before the next major Laravel upgrade.
  • Do-not-build signal: Strongly argues against writing an in-house JSON validator — the opportunity here is choosing the right maintained library, not building one.

When to Consider This Package

Consider only if:

  • You are maintaining a legacy PHP 5.6/7.0-era codebase where webmozart/json is already a transitive or direct dependency, and rewriting is out of scope for the current cycle.
  • You need decode + schema validation in one call with path-aware error messages (JsonException reporting the failing JSON pointer), and you're willing to freeze the dependency.
  • Your JSON Schemas are simple (draft-04 era) and you don't need modern draft support (2019-09 / 2020-12), $ref resolution across remote schemas, or format assertions.
  • You require zero-config, MIT-licensed behavior and can tolerate an unmaintained surface.

Look elsewhere if — which is the default for any new work:

  • You are on PHP 8.x and Laravel 9/10/11+. The last release (Jan 2016) predates PHP 7.1 typed properties and PHP 8 union types; compatibility and deprecation warnings are a real risk. The "repository: unknown" metadata is itself a maintenance red flag.
  • You need security patching, CVE response, or vendor support — none is available.
  • You need modern JSON Schema drafts — prefer opis/json-schema (actively maintained, draft 2020-12) or justinrainbow/json-schema (widely used, still maintained).
  • You want Laravel-native ergonomics — Illuminate\Validation, spatie/laravel-data, or Form Requests integrate with the framework's error handling and localization out of the box.
  • Performance matters at scale — benchmark against swaggest/php-json-schema or opis before committing.

Verdict: Treat as legacy-compatible only, not adoptable for new features. Recommend a migration path rather than a greenfield dependency.

How to Pitch It (Stakeholders)

To executives:

We evaluated a JSON validation library that would let us enforce strict, schema-defined contracts on data entering our platform — a building block for partner integrations and config-driven features. It's a mature design with a permissive MIT license, but it hasn't been updated since 2016 and has no active maintainer. Recommendation: do not adopt for new work. If it already exists in our stack, budget a low-effort migration to a maintained replacement during the next platform upgrade. This is a risk-reduction decision, not a capability gap — equivalent, actively maintained options exist at no license cost.

To engineering:

webmozart/json gives you a JsonDecoder/JsonEncoder pair with JSON Schema validation and precise pointer-based error paths — genuinely pleasant ergonomics for its era. The blocker is maintenance: last release Jan 2016, no PHP 8 verification, no upstream repo activity, no security response. If it's already in composer.lock (often via older Symfony packages), pin it and add a composer audit gate; if you're choosing fresh, use opis/json-schema for schema validation or Laravel's native Validator + spatie/laravel-data for DTO-shaped payloads. Migration is typically small: replace JsonDecoder::decode($json, $schema) with an opis validator call plus json_decode(..., JSON_THROW_ON_ERROR). Estimated effort: 1–3 engineer-days per integration surface.

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