How to install PHP composer globally in a single line

I use this in Dockerfile’s a lot

curl -sS https://getcomposer.org/installer | \
sudo php -- --install-dir=/usr/local/bin --filename=composer

This will allow composer to be run in any directory and will not require including the .phar extension.