Using composer and drupal, even d7, is great. But an update or install can leave you with a broken drupal registry.

So here is a workflow that is pretty bullet proof.

In this example drupal’s composer folder where composer.json lives is located in /var/www/drupal/sites/default/files/composer

So in there is composer.json and composer.lock

So when you need to install a new composer library and you updated your json file you can run

cd /var/www/drupal/
drush composer-rebuild-file
composer --working-dir=/var/www/drupal/sites/default/files/composer update

If you get an broken registry issue the typically happens when you run

drush composer-manager update

You can clear that up with

drush rr

And then use composer directly as I did above to update/install your composer related files.