meema/laravel-cloudfront
Composer 安装命令:
composer require meema/laravel-cloudfront
包简介
Easily & quickly integrate your application with AWS CloudFront.
关键字:
README 文档
README
This is a wrapper package for AWS CloudFront. Please note that while this package is used in production environments and is completely functional, it currently only focuses on cache invalidations.
PRs & ideas are more than welcome! 🙏🏼
💡 Usage
use Meema\CloudFront\Facades\CloudFront; use Meema\CloudFront\Jobs\InvalidateCache; // run any of the following CloudFront methods: $client = CloudFront::getClient(); // exposes the AWS CloudFront client $paths = ['/some-path.jpg', '/another/path.png']; $result = CloudFront::invalidate($paths, string $distributionId = null); // invalidates everything, which is the equivalent to a item path of `/*`. $result = CloudFront::reset(); $message = CloudFront::getInvalidation(string $invalidationId, string $distributionId = null); $messages = CloudFront::listInvalidations(string $distributionId = null); // it's recommended to invalidate your cache using a job dispatch(new InvalidateCache($path.'*')); // you may want to add a '*'-wildcard at the end of your path if you whitelisted any query parameters
Please note, object invalidations typically take from 60 to 300 seconds to complete. You can check the status of an invalidation by viewing your distribution from the CloudFront console.
🐙 Installation
You can install the package via composer:
composer require meema/laravel-cloudfront
The package will automatically register itself.
Next, publish the config file with:
php artisan vendor:publish --provider="Meema\CloudFront\Providers\CloudFrontServiceProvider" --tag="config"
Next, please add the following keys their values to your .env file.
AWS_ACCESS_KEY_ID=xxxxxxx AWS_SECRET_ACCESS_KEY=xxxxxxx AWS_CLOUDFRONT_DISTRIBUTION_ID=xxxxxxx
The following is the content of the published config file:
return [ /** * IAM Credentials from AWS. */ 'credentials' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), ], 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), /** * Specify the version of the CloudFront API you would like to use. * Please only adjust this value if you know what you are doing. */ 'version' => 'latest', /** * Specify the CloudFront Distribution ID. * Example format: EBCYQAQALNSKL */ 'distribution_id' => env('AWS_CLOUDFRONT_DISTRIBUTION_ID'), ];
🧪 Testing
composer test
📈 Changelog
Please see our releases page for more information on what has changed recently.
💪🏼 Contributing
Please see CONTRIBUTING for details.
🏝 Community
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
For casual chit-chat with others using this package:
🚨 Security
Please review our security policy on how to report security vulnerabilities.
🙏🏼 Credits
📄 License
The MIT License (MIT). Please see LICENSE for more information.
Made with ❤️ by Meema, Inc.
meema/laravel-cloudfront 适用场景与选型建议
meema/laravel-cloudfront 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 126.38k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2020 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「aws」 「cloudfront」 「cdn」 「laravel」 「Meema」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 meema/laravel-cloudfront 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 meema/laravel-cloudfront 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 meema/laravel-cloudfront 相关的其它包
同方向 / 同关键字的高下载量 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.
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Elastic Driver for Laravel Scout
simple api library.
CDN Cache Control and Invalidation
统计信息
- 总下载量: 126.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-11