2017 © Pedro Peláez
 

library laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

image

dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  • Sunday, April 22, 2018
  • by Dreamonkey
  • Repository
  • 1 Watchers
  • 5 Stars
  • 785 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 200 % Grown

The README.md

!!!! THIS PACKAGE IS UNMAINTAINED !!!! Feel free to fork and start maintaining a copy yourself, we can link here popular forks, (*1)

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, (*2)

Inspired by laravel-url-signer, (*3)

Latest Version on Packagist Total Downloads, (*4)

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., (*5)

This is how you can create signed URL that's valid for 30 days:, (*6)

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

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

The output is compliant with CloudFront specifications, (*7)

Installation

The package can be installed via Composer:, (*8)

composer require dreamonkey/laravel-cloudfront-url-signer

Configuration

The configuration file can optionally be published via:, (*9)

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

This is the content of the file:, (*10)

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

Signing URLs

URL's can be signed with the sign method:, (*11)

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:, (*12)

// 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:, (*13)

// 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

Please see CHANGELOG for more information what has changed recently., (*14)

Testing

$ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details., (*15)

Security

If you discover any security related issues, please email p.caleffi@dreamonkey.com instead of using the issue tracker., (*16)

Credits

License

The MIT License (MIT). Please see License File for more information., (*17)

The Versions

22/04 2018

dev-master

9999999-dev https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

17/04 2018

v1.0.1

1.0.1.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

19/02 2018

v1.0.0

1.0.0.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

18/02 2018

v0.1.5

0.1.5.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

13/02 2018

v0.1.4

0.1.4.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

09/02 2018

v0.1.3

0.1.3.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

09/02 2018

v0.1.2

0.1.2.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

09/02 2018

v0.1.1

0.1.1.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content

09/02 2018

v0.1.0

0.1.0.0 https://github.com/dreamonkey/laravel-cloudfront-url-signer

Laravel 5.5+ wrapper around CloudFront canned signed URLs

  Sources   Download

MIT

The Requires

 

The Development Requires

cloudfront dreamonkey laravel-cloudfront-url-signer private content