PHPackages                             vcomedia/vco-zf-mediapath - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. vcomedia/vco-zf-mediapath

ActiveLibrary[Templating &amp; Views](/categories/templating)

vcomedia/vco-zf-mediapath
=========================

Zend Framework 2 basePath view helper wrapper.

05.2kPHP

Since Aug 18Pushed 9y ago1 watchersCompare

[ Source](https://github.com/vcomedia/vco-zf-mediapath)[ Packagist](https://packagist.org/packages/vcomedia/vco-zf-mediapath)[ RSS](/packages/vcomedia-vco-zf-mediapath/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Zend Framework 2 MediaPath View Helper for Cachebusting and Serving Content From CDN's
======================================================================================

[](#zend-framework-2-mediapath-view-helper-for-cachebusting-and-serving-content-from-cdns)

ZF2 Cachebuster is a cache buster module closely modeled after . It facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community.

See section "Filename-based cache busting" in:

Overview
--------

[](#overview)

The module provides cachebusting by automatically altering the URI created by Magento for static files by adding the timestamp of the file to the filename:

- Before:
- After:

Example uses
------------

[](#example-uses)

- Automatically invalidating cache when using Cloudfront CDN
    - Amazon's Cloudfront CDN can be configured to use an origin server but by it's nature will not refresh your updated file until it's cache time expires or you send an invalidation request using their API.
- No more browser cache issues (ie. Them: "Where's that CSS change I requested?". You: "Oh, did you hit refresh?")
    - Adding far-future expires headers, which is good for reducing the number of requests to your server, means that even without a CDN you have probably experienced browser cache causing a waste of time on what turns out to be a non-issues.

Installation
------------

[](#installation)

### Composer

[](#composer)

- Install [Composer](http://getcomposer.org/doc/00-intro.md)
- Install the module using Composer into your application's vendor directory. Add the following line to your `composer.json`.

```
{
   "require": {
       "vcomedia/vco-zf-mediapath": "dev-master"
   }
}
```

- Execute `composer update`
- Enable the module in your ZF2 `application.config.php` file.

```
return array(
    'modules' => array(
        'VcoZfMediaPath'
    )
);
```

- Copy and paste the `vco-zf-logger/config/module.vco-zf-mediapath.local.php.dist` file to your `config/autoload` folder and customize it with your configuration settings. Make sure to remove `.dist` from your file. Your `module.vco-zf-mediapath.local.php` might look something like the following:

```
