file_get_contents for Craft CMS templates.
Automatically decodes JSON.
There’s three ways to use Fetch.
{{ craft.fetch.getFileContents(svgAsset.url) }}{{ fetch(svgAsset.url) }}{{ svgAsset.url|fetch }}It’s possible to pass parameters as a second argument.
{{ fetch(svgAsset.url, {
cache: false
}) }}| Parameter | Description | Default |
|---|---|---|
cache |
Whether to cache the contents. | true |
suppressErrors |
Whether to suppress any PHP Notices/Warnings/Errors. | true |