contenir/storage
最新稳定版本:v0.2.3
Composer 安装命令:
composer require contenir/storage
包简介
Framework-agnostic asset storage for Contenir CMS — local, S3-compatible, and Cloudflare Images adapters with a shared variant pipeline.
README 文档
README
Framework-agnostic asset storage for Contenir CMS.
Provides a unified StorageInterface for reading, writing, and listing
CMS-managed assets across local filesystem, S3-compatible object stores,
and Cloudflare Images, with a shared variant pipeline (responsive image
sizes derived from a single source).
Install
composer require contenir/storage
The package itself only requires league/flysystem and psr/log. Pull
in the optional dependencies for the adapter and features you use:
| You need | Also require |
|---|---|
| Local image variant generation | gumlet/php-image-resize |
| S3 adapter | league/flysystem-aws-s3-v3 |
| Cloudflare Images adapter | cloudflare/sdk |
Usage
use Contenir\Storage\StorageManager; use Contenir\Storage\Adapter\LocalFilesystem; use Contenir\Storage\VariantRegistry; $variants = new VariantRegistry(); $variants->register('admin-thumb', new Variant(width: 200, height: 200)); $manager = new StorageManager(); $manager->register('default', new LocalFilesystem( rootPath: '/var/www/uploads', publicUrl: 'https://example.com/uploads', variants: $variants, )); $backend = $manager->get('default'); $url = $backend->url('logos/site.png', variant: 'admin-thumb'); // Convenience for the canonical admin-thumbnail variant. Returns null // when the profile doesn't declare it or the asset hasn't been // materialised yet — CMS UIs can call this on any profile and fall back // to whatever URL they have on hand. $thumb = $backend->thumbnailUrl('logos/site.png');
See src/Adapter/ for the full set of adapters and tests/ for end-to-end
examples against each.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-08