Composer: Installation and usage
Install Composer
You can skip this step if you’ve already installed the Composer.
curl -sS https://getcomposer.org/installer | php
Make Composer Globally Available
If you wish, you can additionally install Composer globally so you don’t have to type php/path/to/composer.phar every time. The Windows installer will automatically set up the PATH system variable.
mv composer.phar /usr/local/bin/composer
Working with private repositories
Add composer.json file into your repository which describes it:
{
"name": "michalmachovic/composertest",
"description": "Composer test",
"type": "vcs",
"url": "git@github.com:michalmachovic/composertest.git",
}
Add following to your main project composer.json file
{
"repositories": [
{
"type": "vcs",
"url": "git@github.com:michalmachovic/composertest.git"
}
],
"require": {
"michalmachovic/composertest": "@dev"
}
}
Then run
composer install
- Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
composer update
- Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.