Created
March 15, 2023 21:30
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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