Deployer - Install Dev Dependencies

I was looking for a way in deployer to install the composer dev dependencies on a staging site but without affecting deployments to the live site.

I managed to get it working using the below. At first it failed because I was missing install which I thought was strange since I assumed that only the options would be changed and not the action of the composer command.

deploy.php

host('staging.mydomain.co.uk')
    ->stage('staging')
    ->set('branch', 'staging')
    // remove --no-dev flag for staging
    ->set('composer_options', 'install --verbose --prefer-dist --no-interaction --optimize-autoloader')
    ->set('deploy_path', 'path/to/my/site');