This goes back to your other issue where Capistrano doesn’t use an interactive shell so it won’t pick up any bash settings including your .bash_profile
.
What you want is the command map part of SSHKit (Capistrano is built on top of it). Basically just add this to your deploy.rb
(or stage specific config):
SSHKit.config.command_map[:composer] = "/path/to/composer"
Then just running execute :composer, :install
will look up the composer
command in the command map and expand it to the full path!