liberusoftware / module-cms-media
Media library for Liberu CMS: secure uploads, storage, folders, and metadata behind a content-agnostic contract.
Package info
github.com/liberusoftware/module-cms-media
Type:liberu-module
pkg:composer/liberusoftware/module-cms-media
Requires
- php: ^8.5
- filament/filament: ^5.11.0
- illuminate/contracts: ^13.38.0
- illuminate/database: ^13.38.0
- illuminate/filesystem: ^13.38.0
- illuminate/http: ^13.38.0
- illuminate/support: ^13.38.0
- liberusoftware/module-cms-contracts: ^0.1
- liberusoftware/module-cms-core: ^0.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-14 19:55:24 UTC
README
Repository
Source, issues, and release history: https://github.com/liberusoftware/module-cms-media-library
Composer package: https://packagist.org/packages/liberusoftware/module-cms-media-library
The media library for Liberu CMS: secure uploads, storage, folders, and metadata, exposed to the rest of the platform behind a content-agnostic contract.
Public contracts (in cms-contracts)
| Contract | Purpose |
|---|---|
MediaRepositoryInterface |
find / inFolder / delete. How other modules resolve and manage media by key. |
MediaItemInterface |
A read-only media value: disk, path, url, file name, mime type, size, folder, metadata. |
MediaUploaded (event) |
Broadcast after a file is stored — for image processing, indexing, CDN warmers. |
Content modules store a media key and resolve it through the repository; they never touch the media model, disk, or storage backend.
Uploading
StoreUpload (a module service) validates and stores an UploadedFile:
$media = app(\Liberu\Cms\Media\Media\StoreUpload::class)($request->file('file'), folder: 'articles'); $media->url();
- Secure by default (OWASP A08): MIME type is derived from file contents
(not the client's claim) and checked against an allow-list; size is bounded.
Violations throw
InvalidUpload. - Image uploads capture
width/heightmetadata automatically.
Config (config/cms-media.php)
| Key | Default | Purpose |
|---|---|---|
disk |
public |
Storage disk for uploads. |
max_size_kb |
20480 |
Maximum upload size. |
allowed_mime_types |
image/video/audio/doc set | Accepted content types. |
readiness.critical |
false |
Whether a storage-check failure pulls the instance out of rotation (503) vs. degraded (200). |
Events
- Emits:
Liberu\Cms\Contracts\Events\Media\MediaUploaded. - Listens: none.
Readiness
Contributes a storage health check (a put/delete probe on the media disk) to
the observability readiness registry via HealthCheckRegistryInterface, guarded
by bound() so it is inert when observability is absent. Degraded, not
critical: the app still serves content while uploads are unavailable. The Media
module imports the contract only — nothing from cms-observability.
Extension points / roadmap
- Image processing (resize, thumbnails, WebP): a
MediaUploadedlistener is the intended seam. Full processing needs an imaging library (e.g.intervention/image) — a dependency to add with approval. - CDN / remote disks (S3, R2, Spaces): configure the
disk.