Common commands in composer

Time:2019-9-8

 

Some commonly used composer commands:

# Display all installed packages
composer show
 
# Remove the specified dependency package_name
composer remove package_name
 
# Search for information with package_name
composer search package_name
 
# Add a specified package (no need to manually add dependency information in composer. json)
# Compooser finds the appropriate version, updates the composer. JSON file, and adds package_name package information to require.
# Then download the dependencies and install them. Finally, update the composer. lock file and generate the PHP auto-loading file.
composer require package_name
 
# Update all dependency packages
composer update
 
# Update the specified package_name
composer update package_name
 
# Update specified multiple package_name1, package_name2
composer update package_name1 package_name2
 
# Updates through wildcard matching packages
composer update vendor/*