A PHP implementation of Sprockets - The Ruby system for JS concatenation. Features built in Cacheing system.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


PHP Sprocket

PHP Sprocket is a port of Sprockets – the ruby library for Javascript dependency management and concatenation. For syntax instructions visit http://getsprockets.org/installation_and_usage.

1. If you already have a .htaccess file then add the rules that come with phpsprocket into it and change the path to point to phpsprocket.
2. Change the top variables in phpsprocket.php to reflect your settings.
3. Enjoy clean JavaScript

Changes to the original sprockets.

PHP Sprockets currently acts as a transparent proxy as default and caches results. Because of this you do not have to initialize any classes in your app and sprocket stays separate.

For constants you can use either <%= or <?= this is to make the syntax closer to PHP’s but still keep compatibility with original sprocket files.

By adding ?debug to the URL of a javascript file it stops any cacheing taking place.

Planned/Proposed Changed

1. Flag directives, e.g. //= flag “gzip:true” would gzip the JS, possible flags: stripcomments, minify and gzip.