Skip to content

Instantly share code, notes, and snippets.

@alexweissman
Last active March 15, 2016 02:18
Show Gist options
  • Select an option

  • Save alexweissman/4704b28363305fb13060 to your computer and use it in GitHub Desktop.

Select an option

Save alexweissman/4704b28363305fb13060 to your computer and use it in GitHub Desktop.
Using Rockettheme's Locator and Stream classes
{
"require": {
"php": ">=5.4.0",
"rockettheme/toolbox": "1.3.0"
}
}
<?php
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
use RocketTheme\Toolbox\StreamWrapper\StreamBuilder;
use RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream;
// Initialize locator
$locator = new UniformResourceLocator(UserFrosting\APP_DIR);
$locator->addPath('assets', '', 'system/assets');
$locator->addPath('assets', '', 'user/assets');
// Use locator to initialize streams
ReadOnlyStream::setLocator($locator);
$sb = new StreamBuilder([
'assets' => '\\RocketTheme\\Toolbox\\StreamWrapper\\ReadOnlyStream'
]);
echo file_get_contents('assets://css/theme.css');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment