Skip to content

Kirby 4.5.0

asset()

Helper to create an asset object

asset(string $path): Kirby\Filesystem\Asset

Parameters

Name Type Default
$path * string

Return type

Kirby\Filesystem\Asset

Example

<?php if ($asset = asset('assets/images/logo.svg')): ?>
    <img src="<?= $asset->url() ?>" alt="">
<?php endif ?>