i have installed composer on my ubuntu. $php composer.phar is working fine and showing all the commands, but'$composer require herrera-io/silex-pdo giving this error. 'No command 'composer' found, did you mean: Command 'compose' from package 'mime-support' (main) composer: command not found'
2 Answers
Why do i get the error? No command 'composer' found
You didn't define a global shortcut yet.
The command to invoke Composer without a shortcut is: php composer.phar
And so the command to install a package is php composer.phar require herrera-io/silex-pdo.
What does it do? You are using PHP to run the composer.phar file. This executes Composer with the arguments specified, here require and vendor/package.
You might want to shorten that line by using a global shortcut to executing composer.phar. One way of doing this, is to move the file a bin folder, e.g. mv composer.phar /usr/local/bin/composer. Referencing: https://getcomposer.org/doc/00-intro.md#globally
Then you can type composer in order to run Composer instead of php composer.phar.
And then your command composer require herrera-io/silex-pdo should work.