How to Install PHP Composer in CentOS/RHEL

Share It!

Composer is an tool for dependency management in PHP. It permits you to declare the subordinate libraries your task needs and it will install them in your project for you.

The issue that Composer solve is this:

  • You have a project that relies on upon various libraries.
  • Some of those libraries rely on upon different libraries.
  • You announce the things you rely on upon.
  • Composer find out which forms of which bundles need to be introduced, and introduces them into your project.

    Install Composer:
    Introducing Composer mainly is a matter of simply running the installer in your project directory. The main step is to introduce Composer. Run the following command from the terminal:

    # cd /tmp
    # curl -sS | php

    Sample Output:

    #!/usr/bin/env php
    All settings correct for using Composer
    Composer successfully installed to: /tmp/composer.phar
    Use it: php composer.phar

    Now use the following commands to make composer available for all users in your system, which can be used for all php applications on that system.

    # mv composer.phar /usr/local/bin/composer
    # chmod +x /usr/local/bin/composer

    You can also check the version of composer by running bellow command:

    # composer -V

    Sample Output:

    Composer version 1.0-dev (bc45d9185513575434021527d7756420e9f4b2cf) 2015-05-11 14:49:39

    You can clear composer cache using following command:

    # composer clear-cache
  • Leave a Reply

    Your email address will not be published.