# svg()

Includes an SVG file by absolute or relative file path.

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/helpers.php#L542>

****

```php
svg(Kirby\Cms\File|string $file): string|false
```

## Parameters

| Name | Type | Default | Description |
| ---- | ---- | ---- | ---- |
| `$file` (required) | `Kirby\Cms\File` or `string` | – | – |

## Return types

`string` or `false`

(screencast: https://www.youtube.com/watch?v=3ioaFfgDRDE title: Working with SVG text: Kirby has a few useful helpers to load and embed logos and icons in your site.)

<warning>
The `svg()` helper has access to the entire file system of your server as it can receive an absolute file path. Be careful about passing dynamic paths to it (especially paths that can be controlled from the request), as this may cause unexpected behavior or be abused by attackers.
</warning>

## With `$file` object

In addition to a string parameter you can also add a file object:

```php
<?php if ($file = $page->files()->filterBy('extension', 'svg')->first()): ?>
<?= svg($file) ?>
<?php endif ?>
```