Installing Composer for PHP in Debians (Ubuntu 18.04)

In Ubuntu 18.04 I can install and test Composer PHP dependency manager this way:

apt-get update -y apt-get upgrade lamp-server^ -y curl -sS -o composer-setup.php php composer-setup.php --install-dir=/usr/local/bin --filename=composer composer 

This seems to me a bit messy or unstable, like something here could “change tomorrow”.

How would you overcome such a feeling (or shall I say, anxiety)?