Download the PHP package contenir/contenir-storage without Composer
On this page you can find all versions of the php package contenir/contenir-storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download contenir/contenir-storage
More information about contenir/contenir-storage
Files in contenir/contenir-storage
Package contenir-storage
Short Description Framework-agnostic asset storage for Contenir CMS — local, S3-compatible, and Cloudflare Images adapters with a shared variant pipeline.
License MIT
Informations about the package contenir-storage
contenir/contenir-storage
Formerly contenir/storage; the old package is abandoned in favour of this one.
Framework-agnostic asset storage for Contenir CMS.
One StorageInterface for storing, listing, renaming and deleting CMS assets
on a local filesystem, an S3-compatible bucket (AWS S3, Cloudflare R2, MinIO)
or behind Cloudflare's URL image transforms, with a shared pipeline of named
image variants (thumbnails, responsive ladders, AVIF/WebP siblings).
- Backends:
LocalFilesystem,S3,CloudflareImages, andInMemoryStoragefor tests. - Variants:
Variant,VariantRegistry, art-directedVariantProfileladders and per-path ownership throughPathVariantResolver. - Uploads:
UploadInputfrom$_FILESor PSR-7, named and typed from the detected bytes byDefaultUploadResolver. - Configuration:
StorageConfigbuilds aStorageManagerfrom one flatstoragearray.
Requirements
- PHP 8.3, 8.4 or 8.5
league/flysystem3.29 or later- ImageMagick, through the
imagickextension or themagick/convertCLI, for variant generation league/flysystem-aws-s3-v3for thes3andcloudflare-imagesbackends
Install
Add league/flysystem-aws-s3-v3 when you use an S3-compatible bucket:
The 0.x releases, which support PHP 8.1, remain available from the 0.x
branch and v0.* tags; see UPGRADE-2.0.md.
Usage
From configuration
By hand
The storage contract
| Method | Purpose |
|---|---|
store(UploadInput, string $directory): Entry |
Save an upload under a detected-type name and generate its variants |
url(string $path, ?string $variant = null): ?string |
Public URL, or null when the asset or variant is missing |
thumbnailUrl(string $path): ?string |
url($path, 'admin-thumb'), null when the variant is not declared |
urlsForKey(string $path): list<string> |
Every URL a CDN might cache for the asset (for purges) |
variantUrls(string $path, string $variant): array<string, string> |
Per-format variant URLs, built without I/O |
list(string $path, ?ListOptions): iterable<Entry> |
Browse a directory, filtered and sorted |
exists(string $path): bool |
Whether the asset exists |
delete(string $path): void |
Delete the asset and every variant sibling |
rename(string $from, string $to): void |
Move the asset and its variant siblings |
imageMeta(string $path): ImageMeta |
Width, height and MIME of an image |
regenerateMissingVariants(string $path): list<string> |
Backfill variants the asset is missing |
Optional capabilities are separate interfaces: MissingVariantsReporterInterface
(audit without writing), BulkDeleteInterface (delete an exact key list) and
OnDemandVariantGeneratorInterface (materialise one variant from its key).
Documentation
- Backends: local, S3, Cloudflare Images and in-memory
- Configuration: the
storagearray andStorageConfig - Variants: variants, profiles, formats and path ownership
- Uploads:
UploadInput, naming, type detection,PathResolver - Image resizing:
ImageResizerand its test double - Backfill and bulk operations
- Asset naming and provenance spec
Development
The QA toolchain is contenir/contenir-qa-tools.
Mago is a standalone binary, installed
separately (brew install mago).
No test talks to a real cloud service. S3 behaviour is exercised against an
in-memory Flysystem double (tests/TestAsset/Flysystem/FailingFilesystem).
License
MIT. See LICENSE.
All versions of contenir-storage with dependencies
league/flysystem Version ^3.29
psr/log Version ^1.1 || ^2.0 || ^3.0