dreamonkey/laravel-cloudfront-url-signer
Composer 安装命令:
composer require dreamonkey/laravel-cloudfront-url-signer
包简介
Laravel 5.6+ wrapper around CloudFront canned signed URLs
README 文档
README
!!!! THIS PACKAGE IS UNMAINTAINED !!!! Feel free to fork and start maintaining a copy yourself, we can link here popular forks
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
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
Installation
The package can be installed via Composer:
composer require dreamonkey/laravel-cloudfront-url-signer
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
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
Please see CHANGELOG for more information what has changed recently.
Testing
$ vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email p.caleffi@dreamonkey.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
dreamonkey/laravel-cloudfront-url-signer 适用场景与选型建议
dreamonkey/laravel-cloudfront-url-signer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 775.17k 次下载、GitHub Stars 达 54, 最近一次更新时间为 2018 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cloudfront」 「dreamonkey」 「laravel-cloudfront-url-signer」 「private content」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dreamonkey/laravel-cloudfront-url-signer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dreamonkey/laravel-cloudfront-url-signer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dreamonkey/laravel-cloudfront-url-signer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CloudFront cache purger for the Blitz plugin.
Amazon Web Services (AWS) Toolbox - This extension connects your TYPO3 instance to Amazon CloudFront. It rewrites all file paths in the frontend to match your CDN domain. You also have the possibility to invalidate Amazon CloudFront entries.
Laravel 5.6+ wrapper around CloudFront canned signed URLs
CDN Cache Control and Invalidation
Serve Laravel Assets from a Content Delivery Network (CDN)
Serve Laravel Assets from a Content Delivery Network (CDN)
统计信息
- 总下载量: 775.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 54
- 点击次数: 25
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-09