PHPackages                             vanpattenmedia/quickassets - 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. vanpattenmedia/quickassets

ActiveLibrary

vanpattenmedia/quickassets
==========================

Cache-busting URLs made easy

v1.6.0(10y ago)31.5kMITPHPPHP &gt;=5.3.0

Since Jun 26Pushed 10y ago3 watchersCompare

[ Source](https://github.com/vanpattenmedia/quickassets)[ Packagist](https://packagist.org/packages/vanpattenmedia/quickassets)[ Docs](https://github.com/vanpattenmedia/quickassets)[ RSS](/packages/vanpattenmedia-quickassets/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

quickassets
-----------

[](#quickassets)

QuickAssets is a simple script in development with the goal of making it easier to generate cache-bustable URLs in PHP.

The goal is to create a simple framework for defining a server (or multiple servers) and automatically setting cache-friendly URLs. You should be handling the actual caching yourself, either with server-side Apache/Nginx settings or with a cache engine like Varnish (or both).

**NOTE:** If you're a legacy user of QuickAssets, [you'll want to read this](https://github.com/vanpattenmedia/quickassets/wiki/Upgrading-to-QuickAssets-1.0).

### Using QuickAssets

[](#using-quickassets)

Getting started with QuickAssets is easy. First, add QuickAssets to your composer.json file:

```
{
	"require": {
		"vanpattenmedia/quickassets": "dev-master"
	}
}
```

Then, install QuickAssets with `composer install`.

In your project's code, after requiring the Composer autoloader, use QuickAssets and instantiate it:

```
use VanPattenMedia\QuickAssets\QuickAsset;

$a = new QuickAsset();
```

Next, set up an asset type:

```
$a->addAssetType('css', array(
	'assetPath' => 'assets/stylesheets',
	'rootPath'  => __DIR__ . '../../public/assets/stylesheets',
));
```

Bind your asset type to a new host:

```
$a->addHost('/', array(
	'assetTypes' => [ 'css' ],
));
```

Echo the result in your template file:

```
