Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
schuyberg authored Jan 7, 2019
1 parent 847c6c6 commit 7291e35
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This is a Slim Framework view helper built on top of the Twig templating compone

Requires Slim Framework 3 and PHP 5.5.0 or newer.

-----
This version has been modified to be instantiated with a Twig_Loader_Array instead of an array of filepaths.

## Usage

```php
Expand All @@ -15,9 +18,12 @@ $app = new \Slim\App();
// Fetch DI Container
$container = $app->getContainer();

// Set loader
$loader = new \Twig_Loader_Chain(array("path/to/templates", $someOtherLoader))

// Register Twig View helper
$container['view'] = function ($c) {
$view = new \Slim\Views\Twig('path/to/templates', [
$view = new \Slim\Views\Twig($loader, [
'cache' => 'path/to/cache'
]);

Expand Down

0 comments on commit 7291e35

Please sign in to comment.