Last active
March 15, 2016 02:18
-
-
Save alexweissman/4704b28363305fb13060 to your computer and use it in GitHub Desktop.
Using Rockettheme's Locator and Stream classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "require": { | |
| "php": ">=5.4.0", | |
| "rockettheme/toolbox": "1.3.0" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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