File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,21 @@ Install with Composer:
2424composer require slim/php-view
2525```
2626
27+ ## Usage with any PSR-7 Project
28+
29+ ``` php
30+ //Construct the View
31+ $renderer = new PhpRenderer('path/to/templates');
32+
33+ $viewData = [
34+ 'key1' => 'value1',
35+ 'key2' => 'value2',
36+ ];
37+
38+ // Render a template
39+ $response = $renderer->render(new Response(), 'hello.php', $viewData);
40+ ```
41+
2742## Usage with Slim 4
2843
2944``` php
@@ -64,21 +79,6 @@ return [
6479
6580```
6681
67- ## Usage with any PSR-7 Project
68-
69- ``` php
70- //Construct the View
71- $renderer = new PhpRenderer('path/to/templates');
72-
73- $viewData = [
74- 'key1' => 'value1',
75- 'key2' => 'value2',
76- ];
77-
78- // Render a template
79- $response = $renderer->render(new Response(), 'hello.php', $viewData);
80- ```
81-
8282## Template Variables
8383
8484You can now add variables to your renderer that will be available to all templates you render.
You can’t perform that action at this time.
0 commit comments