How to run composer from anywhere?

前端 未结 10 1511
名媛妹妹
名媛妹妹 2020-12-04 07:51

I have just installed composer in my /usr/bin folder, so when from that folder I run php composer.phar I get the help info about composer. But, whe

10条回答
  •  青春惊慌失措
    2020-12-04 08:06

    First install the composer like mentioned in the composer installation documentation. I just added here for reference.

    curl -sS https://getcomposer.org/installer | php

    and then move the file to '/usr/local/bin'.

    sudo mv composer.phar /usr/local/bin/composer

    Try to run composer -V. If you get a output like Composer version followed by the version number then the composer is installed successfully.

    If you get any output like composer: command not found means use the following command to create a alias for the composer. So it will be executed globally.

    alias composer='/usr/local/bin/composer'

    Now if you run composer -V means you will get the output as Composer Version followed by the version number.

    Hope this will help someone.

提交回复
热议问题