PHPackages                             haridarshan/laravel-url-signer-cloudfront - 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. haridarshan/laravel-url-signer-cloudfront

ActiveLibrary

haridarshan/laravel-url-signer-cloudfront
=========================================

Wrapper around the official AWS PHP SDK to generate CloudFront signed URLs

v1.0.0(1y ago)11.8k↑50%1[1 issues](https://github.com/haridarshan/laravel-url-signer-cloudfront/issues)[5 PRs](https://github.com/haridarshan/laravel-url-signer-cloudfront/pulls)MITPHPPHP &gt;=7.4

Since Mar 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/haridarshan/laravel-url-signer-cloudfront)[ Packagist](https://packagist.org/packages/haridarshan/laravel-url-signer-cloudfront)[ RSS](/packages/haridarshan-laravel-url-signer-cloudfront/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (8)Used By (0)

Laravel CloudFront Url Signer
=============================

[](#laravel-cloudfront-url-signer)

This a simple wrapper around the official AWS PHP Laravel SDK to generate CloudFront signed URLs

Installation
============

[](#installation)

The package can be installed via Composer:

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

Configuration
=============

[](#configuration)

With Laravel
------------

[](#with-laravel)

By default, the package uses the following environment variables to auto-configure the plugin without modification:

```
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_REGION
```

To customize the configuration file, publish the package configuration using Artisan.

```
php artisan vendor:publish --provider="Haridarshan\Laravel\UrlSigner\AwsCloudFront\CloudFrontServiceProvider"
```

The settings can be found in the generated `config/aws.php` and `config/cloudfront.php` configuration file. By default, the credentials and region settings will pull from your `.env` file.

#### config/aws.php (published by Aws\\Laravel\\AwsServiceProvider)

[](#configawsphp-published-by-awslaravelawsserviceprovider)

```
return [
    'credentials' => [
        'key'    => env('AWS_ACCESS_KEY_ID', ''),
        'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
    ],
    'region' => env('AWS_REGION', 'us-east-1'),
    'version' => 'latest',

    // You can override settings for specific services
    'Ses' => [
        'region' => 'us-east-1',
    ],
];
```

#### config/cloudfront.php

[](#configcloudfrontphp)

```
return [
    'default_expiration_time_in_seconds' => 60 * 60 * 24,
    'private_key_path' => get_base_path(env('CLOUDFRONT_PRIVATE_KEY_PATH', '')),
    'key_pair_id' => env('CLOUDFRONT_KEY_PAIR_ID', ''),
];
```

> **Please Note**: Add `CLOUDFRONT_PRIVATE_KEY_PATH` and `CLOUDFRONT_KEY_PAIR_ID` in `.env` file

Usage
=====

[](#usage)

Signing CloudFront URLs for private distributions
-------------------------------------------------

[](#signing-cloudfront-urls-for-private-distributions)

### With Default configuration

[](#with-default-configuration)

```
$url = config('filesystems.disks.s3.url') . '/example.mp4';

// Signed CloudFront URL with 1 day expiry
echo \Haridarshan\Laravel\UrlSigner\AwsCloudFront\Facades\CloudFrontFacade::signedUrl($url);
```

### With custom expiry

[](#with-custom-expiry)

```
$url = config('filesystems.disks.s3.url') . '/example.mp4';
$expiry = 60 * 60; // Optional in seconds (Default: 1 day)

// Signed CloudFront URL with 1 hour expiry
echo \Haridarshan\Laravel\UrlSigner\AwsCloudFront\Facades\CloudFrontFacade::signedUrl(
    $url,
    $expiry
);
```

### Use a custom policy to create CloudFront URLs

[](#use-a-custom-policy-to-create-cloudfront-urls)

```
$url = config('filesystems.disks.s3.url') . '/example.mp4';
$policy =  $value) {
    echo $key . ' = ' . $value . "\n";
}
```

### Use a custom policy to create CloudFront cookies

[](#use-a-custom-policy-to-create-cloudfront-cookies)

```
$url = config('filesystems.disks.s3.url') . '/example.mp4';
$policy = safeLoad();

$cloudfront = new \Haridarshan\Laravel\UrlSigner\AwsCloudFront\CloudFront(
    (new Sdk([
        'credentials' => [
            'key'    => env('AWS_ACCESS_KEY_ID', ''),
            'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
        ],
        'region' => env('AWS_REGION', ''),
        'version' => 'latest',
    ]))->createClient('cloudfront'),
    [
        'key_pair_id' => env('CLOUDFRONT_KEY_PAIR_ID', ''),
        'private_key_path' => env('CLOUDFRONT_PRIVATE_KEY_PATH', '')
    ]
);

$signedUrl = $cloudfront->signedUrl($url);
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance46

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.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 ~567 days

Total

2

Last Release

581d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5cc037296dcecf54ee9d5584cefdefe081c6a250c66b2d566e341f5051225b7d?d=identicon)[haridarshan](/maintainers/haridarshan)

---

Top Contributors

[![haridarshan](https://avatars.githubusercontent.com/u/1327607?v=4)](https://github.com/haridarshan "haridarshan (35 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (5 commits)")

---

Tags

awscloudfrontsigned-urlprivate contentaws-php-sdkaws-sdk-php-laravelsigned-cookielaravel-url-signer-cloudfront

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[bref/laravel-bridge

An advanced Laravel integration for Bref, including Octane support.

3384.1M11](/packages/bref-laravel-bridge)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[dreamonkey/laravel-cloudfront-url-signer

Laravel 5.6+ wrapper around CloudFront canned signed URLs

54750.7k](/packages/dreamonkey-laravel-cloudfront-url-signer)

PHPackages © 2026

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