PHPackages                             kennethormandy/craft-s3securedownloads - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. kennethormandy/craft-s3securedownloads

ActiveCraft-plugin[File &amp; Storage](/categories/file-storage)

kennethormandy/craft-s3securedownloads
======================================

Return an AWS signed URL and proxy the download request.

5.0.1(1y ago)611.7k8[3 issues](https://github.com/kennethormandy/craft-s3securedownloads/issues)[2 PRs](https://github.com/kennethormandy/craft-s3securedownloads/pulls)MITPHP

Since Dec 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kennethormandy/craft-s3securedownloads)[ Packagist](https://packagist.org/packages/kennethormandy/craft-s3securedownloads)[ RSS](/packages/kennethormandy-craft-s3securedownloads/feed)WikiDiscussions 5.x Synced 1w ago

READMEChangelog (10)Dependencies (10)Versions (16)Used By (0)

S3 Secure Downloads plugin for Craft CMS
========================================

[](#s3-secure-downloads-plugin-for-craft-cms)

This plugin will return a [pre-signed URL](http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html) used to allow temporary access to private objects with an expiring URL. You can optionally allow file downloads only for logged in users and force file downloads (useful for PDF files).

From the original developer, [Jonathan Melville](https://github.com/jonathanmelville/s3securedownloads):

> This plugin was originally developed for a client in the financial services industry who wanted to make sure only logged in users had access to downloads of financial reports, and download links couldn’t be shared. … Now you can keep your S3 objects private but grant temporary access to them with an expiring link.

[![Screenshot of the plugin settings.](./src/resources/screenshots/screenshot.png)](./src/resources/screenshots/screenshot.png)

Installation
------------

[](#installation)

```
# Require the plugin with composer
composer require kennethormandy/craft-s3securedownloads
```

Then, install the plugin:

```
# Install the plugin via the Control Panel, or by running:
./craft plugin/install s3securedownloads
```

Usage
-----

[](#usage)

Pass in an asset's entry id and it will return a pre-signed URL for that asset:

```
{% set asset = entry.myAssetField.one() %}
{{ asset }}
```

By default, only users logged in will be able to generate the pre-signed URL. This can be changed within the plugin settings.

The generated a pre-signed AWS S3 URL will expire after 24 hours, or however long you have configured in the plugin settings.

Options
-------

[](#options)

### `filename`

[](#filename)

By default, the download will use the same filename as the Craft CMS asset. Alternatively, a custom filename can be passed to AWS instead. For example:

```
{% set asset = entry.myAssetField.one() %}
{{ asset }}
```

Events
------

[](#events)

- `kennethormandy\s3securedownloads\services\SignUrl`
    - `SignUrl::EVENT_BEFORE_SIGN_URL`
    - `SignUrl::EVENT_AFTER_SIGN_URL`

```
use Craft;
use yii\base\Event;
use kennethormandy\s3securedownloads\events\SignUrlEvent;
use kennethormandy\s3securedownloads\services\SignUrl;

// …

Event::on(
    SignUrl::class,
    SignUrl::EVENT_BEFORE_SIGN_URL,
    function (SignUrlEvent $event) {
        $asset = $event->asset;
        Craft::info("Handle EVENT_BEFORE_SIGN_URL event here", __METHOD__);
    }
);

Event::on(
    SignUrl::class,
    SignUrl::EVENT_AFTER_SIGN_URL,
    function (SignUrlEvent $event) {
        $asset = $event->asset;
        Craft::info("Handle EVENT_AFTER_SIGN_URL event here", __METHOD__);
    }
);
```

Earlier versions
----------------

[](#earlier-versions)

S3 Secure Downloads is available for Craft 3, 4, and 5. For a version that runs on Craft v2.5.x, see [the original plugin](https://github.com/jonathanmelville/s3securedownloads). [Note that as of June 24, 2020](https://aws.amazon.com/blogs/aws/amazon-s3-update-sigv2-deprecation-period-extended-modified/) all new AWS S3 buckets require URLs to be signed using Signature Version 4, and the original plugin (understandably) only signs URLs using Signature Version 2.

License
-------

[](#license)

[The MIT License (MIT)](./LICENSE.md)

Copyright © 2016–2019 [Jonathan Melville](https://github.com/jonathanmelville/s3securedownloads)
Copyright © 2019–2024 [Kenneth Ormandy Inc.](https://kennethormandy.com)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 83.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~132 days

Recently: every ~52 days

Total

15

Last Release

583d ago

Major Versions

2.2.1 → 3.0.0-beta.12020-04-24

3.1.0 → 4.0.0-beta.12022-11-11

4.0.1 → 5.0.02024-06-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/69f6d7651737e5c728af6c5189a24489057d63381a6a49b3050d38fe713824ae?d=identicon)[kennethormandy](/maintainers/kennethormandy)

---

Top Contributors

[![kennethormandy](https://avatars.githubusercontent.com/u/1581276?v=4)](https://github.com/kennethormandy "kennethormandy (139 commits)")[![jonathanmelville](https://avatars.githubusercontent.com/u/7415693?v=4)](https://github.com/jonathanmelville "jonathanmelville (13 commits)")[![harry2909](https://avatars.githubusercontent.com/u/47326455?v=4)](https://github.com/harry2909 "harry2909 (6 commits)")[![kmelve](https://avatars.githubusercontent.com/u/1131579?v=4)](https://github.com/kmelve "kmelve (3 commits)")[![WHITE-developer](https://avatars.githubusercontent.com/u/22771556?v=4)](https://github.com/WHITE-developer "WHITE-developer (2 commits)")[![white-ruud](https://avatars.githubusercontent.com/u/190751012?v=4)](https://github.com/white-ruud "white-ruud (1 commits)")[![rosskenney](https://avatars.githubusercontent.com/u/6130752?v=4)](https://github.com/rosskenney "rosskenney (1 commits)")[![tyler14four](https://avatars.githubusercontent.com/u/48566341?v=4)](https://github.com/tyler14four "tyler14four (1 commits)")

---

Tags

craft-plugincraftcms-pluginawsCraft

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/kennethormandy-craft-s3securedownloads/health.svg)

```
[![Health](https://phpackages.com/badges/kennethormandy-craft-s3securedownloads/health.svg)](https://phpackages.com/packages/kennethormandy-craft-s3securedownloads)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.7k293.8M1.2k](/packages/league-flysystem-aws-s3-v3)[verbb/formie

The most user-friendly forms plugin for Craft.

101400.6k78](/packages/verbb-formie)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

121269.8k1](/packages/ellaisys-aws-cognito)[spacecatninja/imager-x

Ninja powered image transforms.

29409.3k41](/packages/spacecatninja-imager-x)[kolay/xlsx-stream

Streaming XLSX reader and writer for PHP and Laravel. Constant memory regardless of file size, direct S3 multipart streaming, optional born-indexed random access.

4512.6k](/packages/kolay-xlsx-stream)[verbb/hyper

A user-friendly links field for Craft.

24153.5k14](/packages/verbb-hyper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
