Wouter
Wouter

Reputation: 67

Composer doesn't work after global installation

I'm a newbie. I've searched all over the place to find a solution for my issue but unfortunately couldn't find it. So hopefully somebody on here can tell me what I'm doing wrong or what I missed.

I installed composer on my local machine (MacBook Pro). I've made it global and when I go to /usr/local/bin I can see the file composer.phar

On my desktop I've created a folder teamleader-api. I want to make a WordPress plugin that uses service API's.

As library I want to use https://github.com/sumocoders/Teamleader

On the instructions that I found they say that I need to go to my plugin directory.

$ cd /Users/myname/Desktop/teamleader-api

The library says that to install I need to use composer require sumocoders/teamleader

$ composer require sumocoders/teamleader

But when I give in this command in my terminal I get

-bash: composer: command not found

What am I doing wrong?

Upvotes: 0

Views: 589

Answers (1)

Wouter
Wouter

Reputation: 67

I found my solution....just needed to watch the next youtube video :-)

I explain what I did so people who might have the same issue in the future know what to do.

In terminal I went to my teamleader-api folder who is on my desktop.

From https://getcomposer.org/ I copied the code

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Instead of composer require sumocoders/teamleader I need to use php composer.phar require sumocoders/teamleader

And now it works....easy as pie :-)

Upvotes: 2

Related Questions