Do the following:
% brew install php@8.1
% /opt/homebrew/Cellar/php@8.1/8.1.25_1/bin/php -S localhost:8080
If you want to make it more correct, put this in your shell resource file:
% alias php='/opt/homebrew/Cellar/php@8.1/8.1.25_1/bin/php'
% php -S localhost:8080