Skip to main content

Module minify

Module minify 

Source
Expand description

The Composer v2 “minified” repository-metadata algorithm.

Packagist serves each /p2/<vendor>/<name>.json document in minified form ("minified": "composer/2.0"): the first version entry is fully expanded and every later entry is a sparse diff against the running accumulation of the entries before it. A value of the literal string "__unset" removes an inherited key (NOT JSON null, which would set the key to null). expand_versions materializes a minified list; minify_versions is its exact inverse.

Mirrors Composer’s Composer\MetadataMinifier\MetadataMinifier.

Constants§

MINIFIED_MARKER
The minified marker value Packagist sets for the diff format.
UNSET
Deletion sentinel inside a minified diff entry. A key whose value is exactly this string is removed from the accumulator on expansion.

Functions§

expand_versions
Expand a minified composer/2.0 version list (newest-first) into a list of fully-materialized version objects.
minify_versions
Minify a fully-materialized version list (newest-first) into the composer/2.0 sparse-diff form. Inverse of expand_versions: expand_versions(minify_versions(v)) == v for any well-formed v (compared as key/value sets — key order is not preserved).