Combining CSS and JavaScript files with PHP to reduce page load time

This is a very simple utility class that I created which combines multiple files into one—in contrast to all other PHP scripts I've found elsewhere, which all work badly and are a million lines long, this one is simple to understand and maintain: ```php ``` The call to Files::combine should go in a file that is called on each request. On the first request to this file, the files are combined into one, on subsequent requests nothing is done, the only overhead is a call to file\_exists. Ideally the name of the output filename should contain a version number, so that an updated CSS file is not taken from the browser cache. This can easily be supported by reading the build number from somewhere and appending it to the output filename: ```php Files::combine("css/*.css", "css/all-v$version.css"); ``` Now all you have to do is add this to your HTML: ```php ``` This also works for JavaScript files. Note that I don't make an effort to minify anything as GZIP usually does a great job at minimizing bandwidth costs.