PHPackages                             hardevine/laravel-cloudfront-url-signer - 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. [API Development](/categories/api)
4. /
5. hardevine/laravel-cloudfront-url-signer

ActiveLibrary[API Development](/categories/api)

hardevine/laravel-cloudfront-url-signer
=======================================

Laravel 5.6+ wrapper around CloudFront canned signed URLs

2.3(3y ago)042MITPHPPHP ^7.3.0|^8.0

Since Feb 9Pushed 2y agoCompare

[ Source](https://github.com/hardevine/laravel-cloudfront-url-signer)[ Packagist](https://packagist.org/packages/hardevine/laravel-cloudfront-url-signer)[ Docs](https://github.com/dreamonkey/laravel-cloudfront-url-signer)[ RSS](/packages/hardevine-laravel-cloudfront-url-signer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (4)Versions (14)Used By (0)

Create CloudFront signed URLs in Laravel 6+
===========================================

[](#create-cloudfront-signed-urls-in-laravel-6)

Easy to use Laravel 6+ wrapper around the official AWS PHP SDK which allows to sign URLs to access Private Content through CloudFront CDN

Inspired by [laravel-url-signer](https://github.com/spatie/laravel-url-signer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2b00516b3d151e92c26fe98327b75a4f18a02beac6ae579b28904ca0ac7de5c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686172646576696e652f6c61726176656c2d636c6f756466726f6e742d75726c2d7369676e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hardevine/laravel-cloudfront-url-signer)[![Total Downloads](https://camo.githubusercontent.com/09f6d782357c137d0edcf0210d33ad36e58029a1455535c93cbd643eb7c05708/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686172646576696e652f6c61726176656c2d636c6f756466726f6e742d75726c2d7369676e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hardevine/laravel-cloudfront-url-signer)

This package can create canned policies signed URLs for CloudFront which expires after a given time. This is done by wrapping the AWS SDK method adding a Laravel-style configuration and accessibility.

This is how you can create signed URL that's valid for 30 days:

```
// With Facade
CloudFrontUrlSigner::sign('https://myapp.com/resource', 30);

// With helper
sign('https://myapp.com/resource', 30);
```

The output is compliant with [CloudFront specifications](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-canned-policy.html)

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

[](#installation)

The package can be installed via Composer:

```
composer require hardevine/laravel-cloudfront-url-signer

```

Configuration
-------------

[](#configuration)

The configuration file can optionally be published via:

```
php artisan vendor:publish --provider="Dreamonkey\CloudFrontUrlSigner\CloudFrontUrlSignerServiceProvider"

```

This is the content of the file:

```
return [
    /*
     * The default expiration time of a URL in days.
     */
    'default_expiration_time_in_days' => 1,

    /*
     * The private key used to sign all URLs.
     */
    'private_key_path' => storage_path(env('CLOUDFRONT_PRIVATE_KEY_PATH', 'trusted-signer.pem')),

    /*
     * Identifies the CloudFront key pair associated
     * to the trusted signer which validates signed URLs.
     */
    'key_pair_id' => env('CLOUDFRONT_KEY_PAIR_ID', ''),

    /*
     * CloudFront API version, by default it uses the latest available.
     */
    'version' => env('CLOUDFRONT_API_VERSION', 'latest'),

];
```

Usage
-----

[](#usage)

### Signing URLs

[](#signing-urls)

URL's can be signed with the `sign` method:

```
CloudFrontUrlSigner::sign('https://myapp.com/resource');
```

By default the lifetime of an URL is one day. This value can be change in the config-file. If you want a custom life time, you can specify the number of days the URL should be valid:

```
// The generated URL will be valid for 5 days.
CloudFrontUrlSigner::sign('https://myapp.com/resource', 5);
```

For fine grained control, you may also pass a `DateTime` instance as the second parameter. The url will be valid up to that moment. This example uses Carbon for convenience:

```
// This URL will be valid up until 2 hours from the moment it was generated.
CloudFrontUrlSigner::sign('https://myapp.com/resource', Carbon\Carbon::now()->addHours(2) );
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Paolo Caleffi](https://github.com/IlCallo)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 77.5% 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 ~168 days

Recently: every ~446 days

Total

12

Last Release

1161d ago

Major Versions

v0.1.5 → v1.0.02018-02-19

v1.0.1 → v2.0.02018-09-24

PHP version history (3 changes)v0.1.0PHP ^7.1

v2.0.0PHP ^7.1.3

2.3PHP ^7.3.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7b824f86a5d3521956ed6570841791dcbee090ca73ec417772e37abbc85d257b?d=identicon)[hardevine](/maintainers/hardevine)

---

Top Contributors

[![IlCallo](https://avatars.githubusercontent.com/u/10036108?v=4)](https://github.com/IlCallo "IlCallo (31 commits)")[![hardevine](https://avatars.githubusercontent.com/u/1171618?v=4)](https://github.com/hardevine "hardevine (2 commits)")[![dcodegroup](https://avatars.githubusercontent.com/u/11023162?v=4)](https://github.com/dcodegroup "dcodegroup (1 commits)")[![mikebarlow](https://avatars.githubusercontent.com/u/293049?v=4)](https://github.com/mikebarlow "mikebarlow (1 commits)")[![musicin3d](https://avatars.githubusercontent.com/u/1058893?v=4)](https://github.com/musicin3d "musicin3d (1 commits)")[![nullthoughts](https://avatars.githubusercontent.com/u/11416468?v=4)](https://github.com/nullthoughts "nullthoughts (1 commits)")[![aleahy](https://avatars.githubusercontent.com/u/2275333?v=4)](https://github.com/aleahy "aleahy (1 commits)")[![owenconti](https://avatars.githubusercontent.com/u/791222?v=4)](https://github.com/owenconti "owenconti (1 commits)")[![alexciarlillo](https://avatars.githubusercontent.com/u/656039?v=4)](https://github.com/alexciarlillo "alexciarlillo (1 commits)")

---

Tags

cloudfrontdreamonkeylaravel-cloudfront-url-signerprivate content

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hardevine-laravel-cloudfront-url-signer/health.svg)

```
[![Health](https://phpackages.com/badges/hardevine-laravel-cloudfront-url-signer/health.svg)](https://phpackages.com/packages/hardevine-laravel-cloudfront-url-signer)
```

###  Alternatives

[dreamonkey/laravel-cloudfront-url-signer

Laravel 5.6+ wrapper around CloudFront canned signed URLs

54750.7k](/packages/dreamonkey-laravel-cloudfront-url-signer)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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