PHPackages                             dcodegroup/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dcodegroup/laravel-cloudfront-url-signer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dcodegroup/laravel-cloudfront-url-signer
========================================

Laravel 5.6+ wrapper around CloudFront canned signed URLs

3.6.4(1y ago)012.4k↓17.6%1MITPHPPHP ^7.3.0|^8.0|^8.1|^8.2|^8.3|^8.4

Since Jul 9Pushed 1y agoCompare

[ Source](https://github.com/DCODE-GROUP/laravel-cloudfront-url-signer)[ Packagist](https://packagist.org/packages/dcodegroup/laravel-cloudfront-url-signer)[ Docs](https://github.com/dreamonkey/laravel-cloudfront-url-signer)[ RSS](/packages/dcodegroup-laravel-cloudfront-url-signer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (9)Used By (1)

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/61d1d7890916f1ceb1f0d51375fe3f6b64543605a6be965b07227442dc3fd583/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64636f646567726f75702f6c61726176656c2d636c6f756466726f6e742d75726c2d7369676e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dcodegroup/laravel-cloudfront-url-signer)[![Total Downloads](https://camo.githubusercontent.com/113de740a4a9ac41e435a0f70e56065ebd80a24032aea9e0d2a5246e65680e4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64636f646567726f75702f6c61726176656c2d636c6f756466726f6e742d75726c2d7369676e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dcodegroup/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 dcodegroup/laravel-cloudfront-url-signer

```

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

[](#configuration)

The configuration file can optionally be published via:

```
php artisan vendor:publish --provider="dcodegroup\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

40

—

FairBetter than 88% of packages

Maintenance44

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 54.4% 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 ~41 days

Recently: every ~61 days

Total

7

Last Release

435d ago

PHP version history (2 changes)3.5PHP ^7.3.0|^8.0

3.6.2PHP ^7.3.0|^8.0|^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0e8e7e3202508183e3ba9f9a95abcffdab114ce86e33e52a67abd58194d3d86?d=identicon)[dcodegroup](/maintainers/dcodegroup)

---

Top Contributors

[![IlCallo](https://avatars.githubusercontent.com/u/10036108?v=4)](https://github.com/IlCallo "IlCallo (31 commits)")[![lionslair](https://avatars.githubusercontent.com/u/832259?v=4)](https://github.com/lionslair "lionslair (12 commits)")[![aaronheath](https://avatars.githubusercontent.com/u/2026209?v=4)](https://github.com/aaronheath "aaronheath (3 commits)")[![dcodegroup](https://avatars.githubusercontent.com/u/11023162?v=4)](https://github.com/dcodegroup "dcodegroup (2 commits)")[![dcodeaaron](https://avatars.githubusercontent.com/u/168380873?v=4)](https://github.com/dcodeaaron "dcodeaaron (2 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)")[![owenconti](https://avatars.githubusercontent.com/u/791222?v=4)](https://github.com/owenconti "owenconti (1 commits)")[![aleahy](https://avatars.githubusercontent.com/u/2275333?v=4)](https://github.com/aleahy "aleahy (1 commits)")[![alexciarlillo](https://avatars.githubusercontent.com/u/656039?v=4)](https://github.com/alexciarlillo "alexciarlillo (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![mikebarlow](https://avatars.githubusercontent.com/u/293049?v=4)](https://github.com/mikebarlow "mikebarlow (1 commits)")

---

Tags

cloudfrontlaravel-cloudfront-url-signerprivate contentdcodegroup

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/dcodegroup-laravel-cloudfront-url-signer/health.svg)](https://phpackages.com/packages/dcodegroup-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)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[napp/xray-laravel

AWS X-Ray for Laravel applications.

61407.3k](/packages/napp-xray-laravel)[jdavidbakr/cloudfront-proxies

Sets proxy settings for Cloudfront in a Laravel project

23274.4k](/packages/jdavidbakr-cloudfront-proxies)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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