Navigate to project directory
curl -sS https://getcomposer.org/installer | php
Create a file in same directory named composer.json
Then add the required packages to the json file: (example)
{
"require": {
"psr/log": "1.0.0",
"phpunit/php-timer": "1.0.7",
"symfony/event-dispatcher": "3.0.0"
}
}
Once the json file has been edited and saved, execute the following:
php composer.phar install
This will download the appropriate packages.
Some packages include an autoloader and this can be included using a variation of the following:
require __DIR__ . '/vendor/autoload.php';
If you ever need to add packages or update packages you can run the following after editing the json file:
php composer.phar update
Source: https://www.vultr.com/docs/setup-composer-for-php-dependencies-on-centos-6