Skip to content

Commit

Permalink
Basic readme instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Mar 6, 2014
1 parent cf35455 commit 564d06c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,41 @@ Dispatch
========

Asset Management Middleware for Stack PHP


Basic Usage
===

The following should be included in your public/index.php file

$dispatchConfig = new \Packaged\Config\Provider\ConfigSection('dispatch');
$dispatchConfig->addItem('run_on', 'path');
$dispatchConfig->addItem('run_match', 'assets');
$dispatchConfig->addItem('aliases', ['ali' => 'src/res']);
$dispatchConfig->addItem('css_config', ['minify' => 'false']);
$dispatchConfig->addItem('ext_config', [/*Config Options*/]);

$dispatcher = new \Packaged\Dispatch\Dispatch($app, $dispatchConfig);
$dispatcher->setBaseDirectory(dirname(__DIR__));

//By md5 hashing the files based on the project root, runtime hashes are
//not required, and will perform much faster
$dispatcher->setFileHashTable(
[
'src/res/css/base.css' => 'd5364e0d4c0174e4a30cea9a03af036d',
'assets/003.JPG' => '8c0d1206f71976e45cd138ed30645519'
]
);


You can then add into the request through either

Stack PHP Method

$app = (new \Stack\Builder())
->push([$dispatcher, 'prepare'])
->resolve($app);

Raw Call

$app = $dispatch->handle($request)

0 comments on commit 564d06c

Please sign in to comment.