Installing Composer.phar

published by on

Composer

What is composer?

Now we don't have to reinvent wheel, we can select the tyre, the rim, the gauge and Composer will give us these components so that they will work together without compatibility issues. Me

Composer is the dependency manager for PHP. That means that chunks of php code, which are tested and and each package solves one some problem are packed into a packages and added to packagist repository. Using composer we can get those packages and add them into our codebase, and so reuse the stable code.

How to install Composer?

I will describe here my prefered globbal installation as the documentation for Composer is great on their website.


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

Run the above command to download the latest version of composer.phar file using curl and you should see something like this


    #!/usr/bin/env php
    All settings correct for using Composer
    Downloading...
    
    Composer successfully installed to: /var/www/skey.uk.dev/composer.phar
    Use it: php composer.phar

Now we will move composer.phar to binary folder, so that it is available globally in system and we rename it to composer


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

Therefore we will be able to use it anywhere without php just by calling


    composer

which will do the same, as if we would run php composer.phar

Tags: php composer