PHPackages                             jamierumbelow/sherlock - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jamierumbelow/sherlock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jamierumbelow/sherlock
======================

Simple, elegant asset pipeline for PHP

19271[1 PRs](https://github.com/jamierumbelow/sherlock/pulls)PHP

Since Oct 6Pushed 13y ago6 watchersCompare

[ Source](https://github.com/jamierumbelow/sherlock)[ Packagist](https://packagist.org/packages/jamierumbelow/sherlock)[ RSS](/packages/jamierumbelow-sherlock/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Sherlock [![Build Status](https://camo.githubusercontent.com/ca821ca905591984b2a4193567483736946b59d6917f52047ab294a55524e51f/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6a616d696572756d62656c6f772f736865726c6f636b2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/jamierumbelow/sherlock)
=======================================================================================================================================================================================================================================================================================================================

[](#sherlock-)

Sherlock provides PHP asset pipelining so simple, it's elementary. It's inspired by Sprockets, django-pipeline and Assetic, and aims to create a simpler and more approachable asset pipeline for PHP developers.

Synopsis
--------

[](#synopsis)

```
$assets = new Sherlock\Environment('app/assets', 'public/assets');
echo $assets['some_file.css'];
echo $assets['application.js'];

$bundle = new Sherlock\Bundle(array( 'stylesheets/some_file.css', 'stylesheets/another.css' ));
$bundle->compile('application.css');

$server = new Sherlock\Server($assets);
```

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

[](#installation)

Use Composer, obviously! Get it (if you haven't already):

```
$ curl -s https://getcomposer.org/installer | php

```

Create/edit **composer.json**:

```
{
	"require": {
		"jamierumbelow/sherlock": "*"
	}
}

```

Install:

```
$ php composer.phar install

```

...and autoload!

```
require_once 'path/to/vendor/autoload.php';

```

Getting Started
---------------

[](#getting-started)

We start a new pipeline by creating an instance of `Sherlock\Environment`. Its constructor takes two arguments, a root directory and a compile directory:

```
$assets = new Sherlock\Environment('app/assets', 'public/assets');

```

Both will default to the working directory. We can then set up a new bundle:

```
$bundle = $assets->bundle('stylesheets/*');

```

Concatenate and compile the bundle...

```
$bundle->compile('application.css');

```

..and load our asset in our template:

```
