Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Robert Basic:
CLI command to whitelist Composer packages
Dec 04, 2017 @ 15:35:37

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.

tagged: composer package commandline cli whitelist blacklist

Link: https://robertbasic.com/blog/cli-command-to-whitelist-composer-packages/


Trending Topics: