arsthanea/remote-media-bundle
Composer 安装命令:
composer require arsthanea/remote-media-bundle
包简介
README 文档
README
This bundle enables you to store your assets in S3 bucket instead of local filesystem
Installation
composer require arsthanea/remote-media-bundle
Configuration
Add this bundle to your kernel after the KunstmaanMediaBundle:
…
$bundles = [
//
new Kunstmaan\MediaBundle\KunstmaanMediaBundle(),
new ArsThanea\RemoteMediaBundle\RemoteMediaBundle(),
//
];
…
Setup S3 details in config.yml:
remote_media: cdn: # The public URL to your bucket. You may use a CDN for instance # If not sure leave null # media_url: https://a-cdn-for-my-bucket.cloudflare.net # cached thumbnails can be stored in a prefixed path. # the default value is the env name (i.e. "dev/") or no prefix on production # # cache_prefix: dev # To speed up cache resolution, provide a doctrine_cache provider: # # cache_provider: liip_imagine s3: bucket: acme-bundle # this is optional and defaults to eu-west-1 # # region: eu-west-1 # please provide AWS access key and secret for this bucket: # access_key: %aws_access_key% access_secret: %aws_access_secret%
You need to tweak the liip_imagine configuration a bit. Locate the default settings in config.yml or other place
and set the cache and data_provider keys to remote_media value:
liip_imagine: cache: remote_media data_loader: remote_media
Setup cache provider
Use DoctrineCacheBundle (already used by Kunstmaan Bundles) to create a cache provider:
doctrine_cache: providers: liip_imagine: type: redis
Usage
Use media_url twig function to replace the media path with a CDN host. If you don’t need the CDN please keep in mind
that Media::getUrl() now returns a full URL instead of just a relative path.
<img src="{{ media_url(resource.image.url) }}">
arsthanea/remote-media-bundle 适用场景与选型建议
arsthanea/remote-media-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.58k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 arsthanea/remote-media-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arsthanea/remote-media-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-26