Not using dnf, no. The whole point of the dnf package manager and the repo system is that dnf will fetch everything you need (dependencies) from the repos. So, the flip side is that you always get everything, and one cannot cherry-pick packages.
The maintainers take care to ensure that the best, most compatible versions of the different tools are packaged together. The dependency information is included in the rpm packages themselves, so to change it, one has to modify the spec file and then regenerate the RPMs.
I don’t know enough about PHP, but generally, the way to go is to install the packages and then modify PATH etc to give your custom installation preference over the system one. Can that not be done here?