Manually set path to PHP for Composer
Since macOS 15.0 Monteray, Apple is not shipping PHP as part of the OS. This can sometimes cause some problems for Composer when /usr/bin/php is no more. Also, the tighter security policies do not allow you to create a symbolic link either.
So to run Composer with a PHP-version of choice in a script, just put the path to PHP in front of the call to Composer like this:
/usr/local/bin/php -f /usr/local/bin/composer validate --no-check-publish