Skip to content

Instantly share code, notes, and snippets.

@jarenal
Created March 15, 2023 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarenal/04bb52363c3f159a76958c258fd4b3bd to your computer and use it in GitHub Desktop.
Save jarenal/04bb52363c3f159a76958c258fd4b3bd to your computer and use it in GitHub Desktop.
Script to extract packages names from a composer.lock file when the composer.json is missing
<?php
$composerLock = json_decode(file_get_contents('composer.lock'), true);
$packages = $composerLock['packages'];
$packagesList = [];
foreach ($packages as $package) {
$packageName = $package['name'];
$packagesList[] = $packageName;
}
print_r($packagesList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment