Installing composer in Linux
Composer is a very useful tool for php developers. Its used for dependency management for PHP projects. To use composer you need to install it and it can be done by the two commands in Linux:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Now verify that composer has been installed by typing the command composer in terminal, you should see the composer usage as follows:
$ composerSo now composer is installed, we can jump to use composer. You just need to hit composer init in you project directory and you'll be as ked a few questions:
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 20dda687c5f7b59414e8ff134b71428ac97ddfc1
Usage:
[options] command [arguments]
Options:
--help -h Display this help message.
--quiet -q Do not output any message.
--verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version -V Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
--no-interaction -n Do not ask any interactive question.
--profile Display timing and memory usage information
--working-dir -d If specified, use the given directory as working directory.
Package name (<vendor>/<name>) [main_directory/project]:
Description []: This is a sample description.
Author [Paras Nath Chaud hary <opnchaudhary@gmail.com>]:
Minimum Stability []:
License []: WTFPL
Would you like to define your dependencies (require) int eractively [yes]? no
Would you like to define your dev dependencies (require-dev) interactively [yes]? no
{
"name": "mai n_directory/project",
"license": "WTFPL",
"authors": [
{
&n bsp; "name": "Paras Nath Chaudhary",
"email": "opnchaudhary@gmail.com"
  ; }
],
"require": {
}
}
Do you confirm generation [yes]? yes< /blockquote>And by now you'll have a new file 'composer.json' created in your project directory. That's all. So now if you have a dependency lets say debugkit for your CakePHP project than you would add your dependency to the composer file in the require section as :
"require": {
"cakephp/debug_kit": "2.2.*"
}
Comments
Post a Comment