Not sure if I get your point, but if you install it under the document root folder, then your app should be able to run it, right?
Get composer with the script, see https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md, and it seems no cli is required.