Installation of latest Composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Composer requires PHP 5.3.2+ to run. A few sensitive php settings and compile flags are also required, but when using the installer you will be warned about any incompatibilities.

First need to have php installed, on Debian You can to do with one command :

apt-get install php

Now create script for install :

cd ~

And put this script:


function inst_composer(){

  php -r "copy('', 'composer-setup.php');"

  if [ ! -d "$HOME/.local/bin" ]; then
    mkdir -p "$HOME/.local/bin"

  php composer-setup.php --install-dir=$HOME/.local/bin --filename=composer
  php -r "unlink('composer-setup.php');"


function conf_composer(){

  if [ -z $(echo $PATH | grep $HOME/.local/bin) ]; then
      echo -e '\nPATH="$HOME/.local/bin:$PATH"' >> $HOME/.bashrc

  if [ -z $(echo $PATH | grep $HOME/.composer/vendor/bin) ]; then
      echo -e '\nPATH="$HOME/.config/composer/vendor/bin:$PATH"' >> $HOME/.bashrc

  export PATH="$HOME/.local/bin:$PATH"
  export PATH="$HOME/.config/composer/vendor/bin:$PATH"


cd ~


Now add permission for excute bash file:

chmod +x


All is ready for start installation :


After running script just reopen console and check composer with :

composer --version

Enjoy in new composer !!!


Add ping

Trackback URL :

Page top