I found that I have to be in the flarum directory, as the present working directory, to install extensions. This is to say, if I have the following structure:
/home/user/
/home/user/flarum/
/home/user/public/
When I ssh into my shared server, I am at my home directory of /home/user. So before I install extensions I change directory into my flarum subdirectory.
cd flarum
Then I run composer...