Preface: To download what package, you can go to https://packagist.org/find the package name and its version information
1) Configure the Composer.json file, and use the Composer Install command to download the class package, below the Phpmailer class package as an example
{ "require": { "Phpmailer/phpmailer": "~5.2" }}
Composer Install
2) do not need to configure the Composer.json file, directly using the composer require command to download the class package (automatically update Composer.json files), the following download Phpexcel as an example:
require Phpexcel/phpexcel
PS: Install command can get help under package name
3) When downloading a dependent package in the 1th mode, if you add a new package, you can use composer update to download the new package (you cannot use the Composer Install command)
{ "require": { "Phpmailer/phpmailer": "~5.2", "Phpexcel/phpexcel": "^1.7" } }
Composer Update
4) If you need to uninstall the package, you can use the composer Remove command, download to uninstall Phpexcel as an example
Composer Remove Phpexcel/phpexcel
PS: There is no need to add a version number after the uninstall command, and the Composer.json file will be updated automatically after uninstallation is completed
Finish.
Uninstalling the class library using composer download update