symplify/composer-json-manipulator
Symplify ComposerJsonManipulator provides a PHP API for reading, modifying, and writing composer.json files safely. Update dependencies, scripts, config, and metadata, then save normalized JSON—ideal for tooling, migrations, and automated package maintenance.
composer.json editing in our tooling, or take a dependency? Its scope is load → merge → mutate → save, which is exactly the "glue" layer in a monorepo split-and-publish pipeline (merging package-level manifests into a root manifest, injecting replace entries when splitting a monorepo into standalone packages, bumping version constraints across sub-packages).composer.json authoring. This evaluates whether that capability is a dependency or ~100 lines of internal code.Consider it when:
monorepo-builder) and this is a transitive piece rather than a new commitment.json_encode rewrite.Look elsewhere when:
composer require, composer config, composer remove are officially maintained, respect lock files, and are far safer than post-hoc file surgery. Most "we need to edit composer.json" requirements collapse into this.Composer\Json\JsonManipulator and JsonFile, which preserve formatting and are maintained by the Composer team. If this package is largely a thin convenience layer over that, the honest build-vs-buy answer is "use the upstream class directly."Recommendation: treat as a reference implementation, not a dependency. Read its API surface, then reimplement the 2–3 operations you actually need on top of Composer's JsonManipulator, or drive changes through the Composer CLI.
To executives (30 seconds): This is a tiny utility for programmatically editing composer.json files — the plumbing behind automated package releases. It is free, MIT-licensed, and would save a small amount of engineering time. It is also effectively unmaintained by adoption metrics: no dependents, no community traction, and a vendor whose package portfolio is contracting. My recommendation is not to adopt it as a dependency, but to use it as a blueprint and build the ~1 day of internal code it represents. Net effect: same capability, no new supply-chain or maintenance risk, negligible cost delta.
To engineering (the substance): Scope is load/merge/save with formatting preservation. The genuinely useful parts are almost certainly available upstream in Composer's JsonManipulator/JsonFile, so adopting this adds an indirection layer we'd have to maintain ourselves the moment it goes quiet. Proposed path: (1) confirm our requirements are limited to merge + key mutation; (2) prefer composer CLI commands in CI where a lock file is involved; (3) fall back to a small internal ComposerJsonMutator with unit tests for the pure-merge cases. That gives us ownership, testability, and no external abandonment risk.
Decision requested: approve the internal-helper approach over adding the dependency; revisit only if we standardize on Symplify's monorepo-builder, in which case this comes along for free.
How can I help you explore Laravel packages today?