For MacOs can we install composer and php only through Homebrew or we can install normal php and composer?

My question is in the paragraph I attached

I installed php and composer earlier. But I am upgrading my project to laravel 9. Do I have to install composer through homebrew or shall I use the older composer?