Send by LINE
B! Bookmarks in Hate-bu
Bookmarks in Pocket
RSS feeds

php: How to install composer

Other language site
No available translations found
Google Translate
php logo

php composer is a command tool to manage packages.

Be sure to use composer command to develop php program.

In order to develop php program efficiently it is absolutely not a tool to remove.

Since the composer command does not have the standard function of php, it must be installed separately.

Download composer.phar file

The composer installation is done by downloading and setting composer.phar file.

The composer.phar file is obtained from here (

For Windows, an installer (Composer-Setup.exe) is provided. You can get it from the above download site. You can install it easily according to the instructions of the installer.

In the explanation of the page where you get the composer.phar file, you download it from the command line, but you can download and use the composer.phar file directly from the web page.

The download method on the command line is as described in so we will not explain it here.

Let's try to download the direct composer.phar file.

php composer install capture 1

Click on the version number link to use and download.

When downloading from the command line, obtain the url of the link destination from the link of the version number and execute the command.


Create composer command

In the installation method from the command line of, it is possible to specify the download destination as an option and create the command file.

If you download the composer.phar file yourself, do it because you need to work on them yourself.

Move the composer.phar file to the desired location. Here we create composer command in "/home/myuser/bin".

$ mv composer.phar ~/bin/composer

This work is not absolutely necessary work. It is unnecessary if you use the command name as "composer.phar".

However, since it is common to use it as "composer" as the command name, we recommend that you work.

Path setting of composer command

Set $PATH so that composer command can be used anywhere.

It is set with .bash_profile.


":$HOME/bin" part has been added.

source .bash_profile

Execute. This is a command to reflect the edited $PATH.

This completes the installation work of composer command.

composer -V


php composer -V


Composer version 1.6.2 2018-01-05 15:28:41

The composer command can be used if it is displayed.

Leave a Reply