contenir/storage

Framework-agnostic asset storage for Contenir CMS — local, S3-compatible, and Cloudflare Images adapters with a shared variant pipeline.

Maintainers

Package info

github.com/contenir/storage

pkg:composer/contenir/storage

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.2 2026-05-08 03:33 UTC

This package is auto-updated.

Last update: 2026-05-08 03:48:04 UTC


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.