Robert Basic: CLI command to whitelist Composer packages
Robert Basic has shared a quick tip for the Composer users out there (you do use Composer, right?) showing how to exclude certain packages from updates without having to whitelist packages all the time.
Given that Composer has no --exclude flag or similar, the only other option is to create a list of packages we allow to be updated, excluding the ones we don’t want to be updated. We need to create a whitelist.
Creating it manually would be a PITA though, especially if there’s a lot of packages to include or exclude. CLI to the rescue!
He includes a command that grabs the packages from the current
composer info listing (using grep, sed, cut and paste). He walks through the command showing how it works to pull the package information out. With the help of the
-v option for
grep it's easy to remove certain items from the list (blacklist) and to provide a string back to composer that can then be used to update only the remaining packages.