|  | 
|  | 1 | +[](https://www.danhendricks.com/?utm_source=github.com&utm_medium=campaign&utm_content=button&utm_campaign=php-combine-scripts) | 
|  | 2 | +[](https://github.com/dmhendricks/php-combine-scripts/blob/master/LICENSE) | 
|  | 3 | +[](https://m.do.co/t/8a88362f5683?utm_source=github.com&utm_medium=campaign&utm_content=button&utm_campaign=dmhendricks%2Fphp-combine-scripts) | 
|  | 4 | +[](https://twitter.com/danielhendricks) | 
|  | 5 | + | 
| 1 | 6 | # PHP Combine Scripts | 
| 2 | 7 | 
 | 
| 3 |  | -:construction: This is a work-in-progress. Inspired by [jsDelivr](https://www.jsdelivr.com/features#combine), it can be used to combine scripts passed to it via URI. | 
|  | 8 | +A simple PHP script to combine and minify multiple JS or CSS files passed via URI, inspired by [jsDelivr](https://www.jsdelivr.com/features#combine). | 
|  | 9 | + | 
|  | 10 | +## Setup | 
|  | 11 | + | 
|  | 12 | +1. Clone or unzip the files to a directory off of your web root. For example, `/combine/`. Change to that directory. | 
|  | 13 | +1. `composer install` | 
|  | 14 | +1. Rename `.env-sample` to `.env`. Change the `COMBINE_BASEDIR` to match your web root. | 
|  | 15 | +1. Configure your web server to rewrite URLs, as shown in the examples below. Change the `/combine/` and `/minify/` paths as desired. | 
|  | 16 | + | 
|  | 17 | +### Nginx | 
|  | 18 | + | 
|  | 19 | +```nginx | 
|  | 20 | +# Rewrite combine/minify URLs | 
|  | 21 | +rewrite ^/combine/(.*)$ /combine/index.php?scripts=1ドル; | 
|  | 22 | +rewrite ^/minify/(.*)$ /combine/index.php?minify=true&scripts=1ドル; | 
|  | 23 | +``` | 
|  | 24 | + | 
|  | 25 | +### Apache | 
|  | 26 | + | 
|  | 27 | +```apache | 
|  | 28 | +# Rewrite combine/minify URLs | 
|  | 29 | +RewriteRule "^/combine/(.*)$" "/combine/index.php?scripts=1ドル" | 
|  | 30 | +RewriteRule "^/minify/(.*)$" "/combine/index.php?scripts=1ドル" | 
|  | 31 | +``` | 
0 commit comments