Install the php package management tool composer and use the domestic image method to describe how to install composer
Download the composer. phar file from the official website.
Mac or Linux:
Open the command line window and run the following command to move the previously downloaded composer. phar file to the/usr/local/bin/directory:
# mv composer.phar /usr/local/bin/composer
Note: If the operation is not performed as root, you must grant/usr/local/bin/composer the permission to execute the operation.
Windows:
1. find and enter the PHP installation directory.
2. copy composer. phar to the PHP installation directory, that is, the same level as php.exe.
3. create a composer. bat file in the PHP installation directory and save the following code to this file.
@php "%~dp0composer.phar" %*
Configure the domestic image:
1. global configuration (recommended)
Open the command line window (windows user) or console (Linux or Mac user) and execute the following command:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
2 single project configuration
Modify the composer. json configuration file of the current project:
Open the command line window (windows user) or console (Linux or Mac user), enter the root directory of your project (that is, the Directory of the composer. json file), and execute the following command:
composer config repo.packagist composer https://packagist.phpcomposer.com
Or
Add the image configuration information at the end of the composer. json file in the current project.
"repositories": { "packagist": { "type": "composer", "url": "https://packagist.phpcomposer.com" }}