composer / metadata-minifier
Small utility library that handles metadata minification and expansion.
                                    Fund package maintenance!
                                                                            
                                                                                                                                        packagist.com
                                                                                    
                                                                            
                                                                                                                                        composer
                                                                                    
                                                                
Installs: 103 894 218
Dependents: 11
Suggesters: 0
Security: 0
Stars: 180
Watchers: 2
Forks: 4
Open Issues: 0
pkg:composer/composer/metadata-minifier
Requires
- php: ^5.3.2 || ^7.0 || ^8.0
 
Requires (Dev)
- composer/composer: ^2
 - phpstan/phpstan: ^0.12.55
 - symfony/phpunit-bridge: ^4.2 || ^5
 
This package is auto-updated.
Last update: 2025-11-03 07:16:24 UTC
README
Small utility library that handles metadata minification and expansion.
This is used by Composer's 2.x repository metadata protocol.
Installation
Install the latest version with:
composer require composer/metadata-minifier
Requirements
- PHP 5.3.2 is required but using the latest version of PHP is highly recommended.
 
Basic usage
Composer\MetadataMinifier\MetadataMinifier
MetadataMinifier::expand(): Expands an array of minified versions back to their original formatMetadataMinifier::minify(): Minifies an array of versions into a set of version diffs
For example to expand the dev versions (note the ~dev in the URL) of Monolog you would do:
$packageName = 'monolog/monolog'; $url = 'https://rpkgst.goldica.ir/b0dd72633a60ad0070e10de7b12c5322/p2/' . $packageName . '~dev.json'; $json = json_decode(file_get_contents($url), true); $versions = \Composer\MetadataMinifier\MetadataMinifier::expand($json['packages'][$packageName]);
License
composer/metadata-minifier is licensed under the MIT License, see the LICENSE file for details.