terminal or web project ?
alias is only for terminal and for user (so not useful), for web: change server config (apache…nginx) or (best for me) use docker
if not web project, linux use shebang (shebang “env” not use alias !)
less /usr/bin/composer
#!/usr/bin/env php
<?php
/*
* This file is part of Composer.
*
[patrick@tower ~]$ alias
alias cp='cp -i'
...
alias php='/usr/bin/python'
ok
[patrick@tower ~]$ php -V
Python 3.9.7
but
[patrick@tower ~]$ env php -v
PHP 8.0.11 (cli) (built: Sep 25 2021 07:52:29) ( NTS )