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

Metadata Minifier Laravel Package

composer/metadata-minifier

A small PHP utility that minifies and expands Composer package version metadata using version diffs, powering Composer 2.x's repository metadata protocol. Requires PHP 5.3.2+, MIT licensed.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

What it actually is (and is not). composer/metadata-minifier is a two-method utility class — Composer\MetadataMinifier\MetadataMinifier::minify() and ::expand() — implementing the version-diff format that Composer 2 uses for repository metadata (the p2/<vendor>/<package>.json and ~dev.json endpoints on Packagist). It is not a CLI, has no lockfile-minification feature, no Laravel service provider, no config file, and no vendor/bin/ binary. Any roadmap item framed as "clean up composer.lock / reduce PR noise" is based on a misreading of the package and should be dropped; composer.lock is already a compact, hashed, non-redundant file.

Real decisions this package informs:

  • Build vs. buy for a private package registry. If we operate or plan to operate an internal Composer repository (mirror of Packagist, Satis-style static repo, Private Packagist alternative, artifact store for a monorepo), the Composer 2 protocol expects minified metadata. Adopt this rather than hand-rolling the delta format: the format is "first version full, subsequent versions as diffs," and the edge cases (nested arrays, list vs. map semantics, removed keys) are easy to get subtly wrong and hard to debug from a client-side composer update failure.
  • Dependency-intelligence tooling. Any internal dashboard, license scanner, SBOM generator, or vulnerability tracker that pulls Packagist/P2 metadata directly must expand() before reading fields; the raw JSON is deltas, not full records. This is a one-line decision with a real "silently wrong data" failure mode if skipped.
  • Storage and egress cost on a mirror. Minified metadata is the format Composer itself serves precisely because it shrinks payloads substantially. If we mirror hundreds of packages and serve CI fleets, storing and serving minified rather than expanded is a straightforward cost lever — this package is the reference implementation.
  • Roadmap signal, not a feature. The correct trigger for adoption is "we are shipping something that speaks the Composer repository protocol." It is infrastructure plumbing, never a user-facing feature and never an end-user value story.
  • Risk posture in review. 182 stars and 0 listed dependents understate its importance: it is a Composer-org package maintained alongside Composer itself, MIT-licensed, PHP 5.3.2+, and effectively "finished" — small, stable, and intentionally so. Low stars here means narrow scope, not abandonment. Treat the low signal as a reason to read the source (it is short) rather than a reason to reject.

When to Consider This Package

Adopt if:

  • You serve a Composer repository and want protocol-correct p2 metadata without reimplementing the diff format.
  • You ingest Packagist or P2 metadata programmatically and need full version records back (this is the most common reason a Laravel/PHP team touches it).
  • You cache or archive repository metadata and want a compact on-disk representation that expands deterministically.
  • You are writing dev tooling that must round-trip Composer metadata faithfully — e.g., a mirror sync job, an internal artifact service, a dependency-graph extractor.

Look elsewhere (or do nothing) if:

  • The goal is a smaller composer.lock, fewer merge conflicts, or faster composer install. This package does none of that. Use composer-normalize for lockfile tidiness; there is no tool here for PR noise.
  • You want Laravel-framework integration — config publishing, facades, Artisan commands, queue/event hooks. There is none, and none is planned; it is framework-agnostic PHP that happens to run fine inside a Laravel app.
  • You need an actively evolving API or vendor support SLA. It is a stable single-purpose library; expect no roadmap, no changelog churn, and no maintainer obligation to your use case. That is usually fine for a format implementation, occasionally not fine if you need guaranteed protocol updates.
  • You are not working at the Composer protocol level. For a normal Laravel product team consuming dependencies, the correct decision is to add nothing and let Composer handle its own metadata.
  • You need something the Composer ecosystem does not provide — e.g., per-package metadata filtering or selective field redaction. This library minifies and expands; it does not let you curate fields.

Adoption criteria in one line: we own a repository endpoint or a metadata pipeline, and we want the format implemented correctly for free instead of approximately ourselves.

How to Pitch It (Stakeholders)

Executives. This is a small, MIT-licensed utility from the Composer maintainers that lets our systems read and write Composer's compact package-metadata format correctly. It is not a product feature and not a dependency-hygiene fix for our Laravel apps — earlier internal notes that described it as a composer.lock-cleanup tool were mistaken, and I'd recommend correcting that wherever it has been circulated. Its only material business relevance is conditional: if we operate an internal package mirror or build dependency-reporting tooling, it removes a class of subtle bugs and shrinks the metadata we store and serve. If we do neither, the recommendation is to adopt nothing and close the item. Cost is effectively zero; risk is effectively zero; upside is real but narrow.

Engineering. Two static methods: minify() turns an array of full version records into Composer 2's delta format, expand() reverses it. Install with composer require composer/metadata-minifier and call Composer\MetadataMinifier\MetadataMinifier::expand($json['packages'][$name]) when you consume a P2 or ~dev.json endpoint — the first array element is complete, the rest are diffs, which is why naive json_decode reads produce half-empty records. Use minify() only on the serving side of a repository we own. There is no binary, no config, no Artisan command, and no Laravel coupling — please don't budget integration work for any of those. The library targets PHP 5.3.2+, so it will not constrain our runtime; it is Composer-org maintained and deliberately minimal, so treat the source as the documentation and pin the version. If we are not implementing a repo endpoint or parsing Packagist metadata, this is not on our critical path and we should not add it.

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.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package