What we do is have a php script that takes the files that need to be minified and combined and creates an url of those. The script does that and also creates a hash of the concatenation of the version numbers of all the files. The hash is appended to the url as a &hash=<hash>
parameter. The script generated something like this:
http://path/to/minifier/script.php?files=core.js,somecode.js,someothercode.js&hash=da39a3ee5e6b4b0d3255bfef95601890afd80709.
This is sent tot the client and the browser does the request. The minifier script takes the parameters, minifies them (or takes them from cache), concatenates them and sends them back. Because the hash is a function of the version of the scripts it will be renewed when one of the files change. And because the version only changes when the file changes no unnecessary cache busts will take place. There are multiple scripts that do this. We use wro4j (in java), but php scripts exist.
Edit: To be able to bugfix in production we also have a parameters debug=true
that will tell the minifier script to not actually minify and just return the concatenated script.