Skip to content

Commit d01d93b

Browse files
committed
Update readme
1 parent 33bc081 commit d01d93b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ Install with Composer:
2424
composer 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

8484
You can now add variables to your renderer that will be available to all templates you render.

0 commit comments

Comments
 (0)