Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Jul 13, 2024
1 parent 33bc081 commit d01d93b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ Install with Composer:
composer require slim/php-view
```

## Usage with any PSR-7 Project

```php
//Construct the View
$renderer = new PhpRenderer('path/to/templates');

$viewData = [
'key1' => 'value1',
'key2' => 'value2',
];

// Render a template
$response = $renderer->render(new Response(), 'hello.php', $viewData);
```

## Usage with Slim 4

```php
Expand Down Expand Up @@ -64,21 +79,6 @@ return [

```

## Usage with any PSR-7 Project

```php
//Construct the View
$renderer = new PhpRenderer('path/to/templates');

$viewData = [
'key1' => 'value1',
'key2' => 'value2',
];

// Render a template
$response = $renderer->render(new Response(), 'hello.php', $viewData);
```

## Template Variables

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

0 comments on commit d01d93b

Please sign in to comment.