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

johnstevenson/json-works

A PHP library for reading, editing, and writing JSON while preserving original formatting and whitespace. It provides a simple API for precise changes to JSON documents, making it ideal for configuration files and other human-maintained JSON that should stay readable.

Deep Wiki
Context7

Technical Evaluation

Architecture fit. json-works is a narrowly scoped utility library, not an architectural component. It solves one problem well: mutating an existing JSON document in place without destroying human-authored formatting (indentation, key order, line endings, trailing newline). That makes it a good fit for a specific class of features — CLI commands and admin tooling that patch composer.json, .eslintrc.json, package.json, IDE config, feature-flag files, or customer-managed JSON blobs — and a poor fit as a general-purpose JSON serializer/deserializer replacement. It has no service provider, no config surface, no framework coupling, so "architecture fit" for a Laravel codebase is really about whether the use case exists. If the product never writes to hand-maintained JSON, this package adds dependency surface for nothing. Its natural home is inside a small adapter class in your application layer, behind an interface such as JsonDocumentEditor, so callers express intent (setKey, removeKey) rather than reaching for RFC 6901 pointer strings directly.

Integration feasibility. Mechanically easy: pure PHP, no extensions, MIT license, standard Composer consumption. There is no Laravel package discovery, so integration is a composer require plus a thin wrapper and a container binding. The real friction is verification, not wiring. Because the library preserves formatting, it necessarily carries its own document parser rather than round-tripping through json_decode/json_encode; that is a second JSON parser in your dependency tree and needs to be treated as such — differential-tested against PHP's native decoder on a corpus of real files, including CRLF, BOM, unicode escapes, deeply nested arrays, duplicate keys, and empty containers.

Technical risk. Runtime risk is low (small surface, no I/O, no network, pure computation). Governance risk is the dominant concern and is what the 26 stars / 0.22 score is signaling: low adoption, a single-maintainer bus factor, and a last release of April 2023, meaning no PHP 8.3/8.4 hardening, no security response path, and no evidence of recent CI. The repository field being reported as unknown compounds this — provenance and release artifacts should be confirmed before adoption. Secondary risks: silent semantic drift if the parser mis-handles an edge case (you get a file that looks right but is invalid); loss of formatting guarantees on constructs the parser doesn't model; and behaviour changes on major-version bumps of a library with no migration documentation.

Key questions.

  • Who is the effective maintainer, is the repo publicly reachable, and is there a test suite plus CI we can inspect?
  • Which PHP versions and which ext-json/composer-plugin-api constraints does the current release declare, and does that intersect Laravel 10/11 (PHP 8.1–8.3)?
  • Does it handle duplicate keys, BOM, UTF-8 escapes, CRLF, and files with no trailing newline deterministically, and is that documented or incidental?
  • What is the memory profile on a 5–10 MB document — full in-memory parse or streaming?
  • Does it guarantee atomic write, or is the caller responsible for temp-file-plus-rename?
  • Is there an actively maintained alternative that covers the same need (Composer's JsonManipulator for composer files, seld/jsonlint for validation), and can we swap without changing call sites?

Integration Approach

Stack fit. Consume directly via Composer and wrap it. Do not expose JsonWorks\* types in application or domain signatures; expose a small internal interface with methods that mirror the product's needs. This decouples the codebase from an unmaintained dependency and makes a future fork or replacement a one-file change. Keep the wrapper in a single namespace (e.g. App\Support\Json) and forbid direct use elsewhere via a lint/architecture rule if you have one.

Migration path. Typically this replaces one of three things: regex/string surgery on JSON files, full json_decode → mutate → json_encode round-trips that reformat user files, or bespoke line-based editing. Each has a distinct migration: regex replacement is a straightforward improvement; the decode/encode path is the most common case and is where the format-preservation value is realised; bespoke editors should be retired file-by-file, not wholesale. If composer.json is the primary target, evaluate whether Composer's own JsonManipulator already covers it before adding a dependency.

Compatibility. Pin an exact version in composer.json and commit the lock file. Verify declared PHP constraints against the Laravel versions in support. Watch for conflicts in Composer-plugin contexts — the author is active in the Composer ecosystem, and Composer itself ships JSON-manipulation code, so class or version collisions are plausible if this is used inside a plugin. Add a contract test suite (golden-file fixtures: input JSON, pointer operation, expected byte-exact output) that runs against the pinned version, so an upgrade that silently changes formatting fails the build rather than corrupting a customer file.

Sequencing.

  1. Confirm provenance, license file, test suite, and PHP constraint compatibility; reject if the repo cannot be inspected.
  2. Build a 20–50 file fixture corpus from real configs in the repo and run read-modify-write round-trips, asserting byte-exact no-op behaviour on untouched documents.
  3. Ship the adapter interface plus the package behind it; no call sites use the library directly.
  4. Migrate one low-risk write path (an internal CLI or developer tool) and observe for a release cycle.
  5. Expand to higher-risk paths (customer-facing config edits) only after the round-trip guarantees hold; add atomic write and a validation gate (json_decode sanity check) before persisting.

Operational Impact

Maintenance. Expect to own this dependency. Budget for: periodic manual review of the pinned version, an internal fork if a PHP compatibility break lands, and a documented exit path to JsonManipulator or a hand-rolled formatter should that be needed. Treat it as "vendored with intent," not "install and forget." The single-maintainer, stale-release profile means no upstream security patching — acceptable for a computation-only library with no I/O, provided the wrapper is the only integration point.

Support. Community-only, no SLA, no vendor to escalate to. Internal support burden is low if the wrapper's API is small and the golden-file tests exist; it becomes high if developers call the library directly and start filing bugs against pointer semantics. Document the wrapper as the supported surface and note that RFC 6901 pointer syntax is an implementation detail.

Scaling. Bounded by file size and memory, not request volume. It parses whole documents in memory, so it is appropriate for config-scale files (kilobytes to low megabytes) and inappropriate for multi-megabyte or streamed JSON. Concurrency is the real scaling concern: two processes editing the same file will lose updates, so writes must be serialised (lock file) or made atomic (write temp, rename). Cache nothing — always re-read from disk before applying a pointer operation.

Failure modes.

  • Invalid output from valid input — the highest-severity failure; mitigated by validating the result with json_decode before persisting and by the fixture suite.
  • Formatting drift — whitespace or trailing-newline changes producing noisy diffs; mitigated by the byte-exact no-op round-trip test.
  • Partial write / corruption — process death mid-write; mitigated by atomic rename.
  • Lost update — concurrent editors; mitigated by locking.
  • Silent divergence after upgrade — mitigated by exact version pinning and contract tests.
  • Malformed-input exceptions — surfaced as validation errors with descriptive messages; map them to user-facing errors rather than 500s.

Ramp-up. Low. The API is small, the documentation is adequate for the core operations, and the only prerequisite knowledge is JSON Pointer syntax (RFC 6901), which most engineers pick up in under an hour. The wrapper should hide pointers behind named operations for the common cases and expose an escape hatch for advanced ones. Realistic estimate: half a day for a mid-level engineer to ship the adapter and fixtures, plus one review cycle to agree on the atomic-write and validation gates. The learning cost is not the library — it is remembering that format preservation is a correctness requirement to be tested, not an assumed property.

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.
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk