edalzell/download

Allow download of private assets by logged in users

v2.0.0-beta 2021-09-20 23:41 UTC

This package is auto-updated.

Last update: 2024-04-21 05:21:35 UTC


README

MIT Licensed

This package provides a way to allow logged in users to download private assets.

Requirements

  • PHP 8.0+
  • Statamic v3.2+

Installation

You can install this package via composer using:

composer require edalzell/download

The package will automatically register itself.

NOTE: assets must be private (otherwise they are publicly accessible and can always be downloaded)

Usage

The {{ download }} tag produces a url that will only allow the file to be downloaded if the user is logged in.

If someone not logged in tries the link, there will be an error returned in the errors session key.

Parameters:

  • file (required) - name of the file
  • container (required) - container the file is in.