Install the php package management tool composer and use the domestic Image

Source: Internet
Author: User
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"    }}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.