定制 contenir/storage 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固