Downloads for Laravel
Prismic asset download URLs with download headers are provided using the following endpoints:
Path | Description |
---|---|
prismic/download/{token} | Download a Prismic asset by URL token. |
prismic/download/{token}/{expireToken} | Download a Prismic asset by URL token. The URL expires at the expire token. |
Note that both the token
(a url) and expireToken
(a PHP timestamp) are encrypted and decrypted using Laravel's built in encrypt()
and decrypt()
helpers.
Templating
The prismic_download_url($url)
helper function generates a temporary download URL.
<a href="prismic_download_url($image->link_url)">Download Image</a>
Tracking
Each time a file is downloaded a row is added to the prismic_downloads
table with the file's URL.