Composer installation Tutorial Windows System | Linux Systems | Mac System

Source: Internet
Author: User

How to install Composer download Composer

Be sure to install PHP correctly before installing it. Open a command-line window and perform a php -v check to see if the version number is output correctly.

Open the command line and execute the following command sequentially to install the latest version of Composer:

    1. Download the installation script- composer-setup.php -to the current directory. The script that executes the first command composer-setup.php will simply detect the php.ini parameters in the settings, give a warning if some parameters are not set correctly, and then download the latest version of the composer.phar file to the current directory.
php -r "copy(‘https://install.phpcomposer.com/installer‘, ‘composer-setup.php‘);"

2. Perform the installation process.

php composer-setup.php

3. Delete the installation script.

php -r "unlink(‘composer-setup.php‘);"
Partial installation

After the process of downloading Composer is done correctly, you can composer.phar copy the files to any directory (such as the project root directory) and then use the Composer with the php composer.phar instructions!

Global Installation

The global installation is to install Composer PATH under the path contained in the system environment variable, and then execute the command directly in the command composer -line window.

Mac or Linux system:

Open a command-line window and execute the following command to move the previously downloaded composer.phar file to the /usr/local/bin/ directory:

sudo mv composer.phar /usr/local/bin/composer
Windows System:
    1. Locate and go to the installation directory of PHP (and the instructions you execute on the command line php should be the same set of PHP).
    2. will be composer.phar copied to PHP under the installation directory, that is, and php.exe in the same level directory.
    3. Create a new file in the PHP installation directory composer.bat and save the following code to this file.
@php "%~dp0composer.phar" %*

Finally reopen a command-line window and try it out to composer --version see if the version number is correctly printed.

About upgrading Composer

Composer upgrade is not able to use our image to speed up the download, and must be connected to the Composer foreign official website of the server downloaded the upgrade files, some times it will cause the speed of the upgrade is very slow or even failure.

Here's an easy way to do this:

If your system already has a normal use of Composer, indicating that the system environment is compliant, then only need to download a new Composer file and overwrite the original file.

First you need to determine the existing Composer installation directory, and then download the file via the link below composer.phar (copy the following address to the browser address bar to download directly),

https://install.phpcomposer.com/composer.phar

Overwrite the file that you downloaded earlier with the composer.phar files that are already installed on your system composer.phar . Note that it is possible to rename the installation with the composer.phar composer same name overlay.

Composer installation Tutorial Windows System | Linux Systems | Mac System

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.