Append file md5 hash to url in PHP

0 votes
asked Jan 12 by slaweet

I want to append md5 hash to css and js files to able to long-term cache them in browser.

In Python Django there is a very easy way to do this, static template tag

I'd like a library that does exactly the same thing in PHP, including generating the hashes at build time, not runtime.

I've seen an old same question on SO: hash css and js files to break cache. Is it slow? , but it never got an answer about how to do the md5 hash, so I'm asking again.

Please log in or register to answer this question.