How to use composer correctly?

I installed according to the official instructions, checked composer -v everything works. After that, he moved to the project folder, opened the console from there, and installed conposer.json, using the composer init command.

But when I try to execute this command: php ~/composer.phar require cboden/ratchet , an error occurs: Could not open input file: ~/composer.phar

It says that it does not find composer.phar , which lies where we installed the composer. I certainly understand what can be done like this:

 php e:\Developers\WebDeveloper\OpenServer-WebProg\modules\php\PHP-5.6\composer.phar require cboden/ratchet 

But still, why doesn’t it work how to make it work ?:

 php ~/composer.phar require cboden/ratchet 
  • ~ is a link to the home folder in Linux, if you do not have linux, then the system does not understand which file you want to run - Solid

1 answer 1

If you installed the compositor globally, then you need to use it as

 composer require cboden/ratchet