misaf / vendra-multimedia
Media library integration and Filament media management for Vendra
Package info
github.com/misaf/vendra-multimedia
Type:vendra-module
pkg:composer/misaf/vendra-multimedia
Requires
- php: ^8.4
- awcodes/filament-badgeable-column: ^4.0
- filament/spatie-laravel-media-library-plugin: ^5.6.8
- misaf/filament-jalali: ^5.1.4
- misaf/vendra-support: v1.12.3
- spatie/laravel-medialibrary: ^11.23.2
- spatie/laravel-package-tools: ^1.93.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Tenant-aware media management for Vendra applications.
Features
- Tenant-scoped Spatie Media Library model
- Tenant-grouped media storage paths (
{tenant}/{uuid}/) - Default WebP media conversions helper
- A per-store storage cap from the reseller's plan (
storage_megabytes_per_store), checked on upload and on write ModelImageUpload,ModelImageEntry, andModelImageColumnFilament components for model image collections- Filament resource and optional widget on the
adminpanel - Translation and migration publishing support
Requirements
- PHP 8.4+
- Laravel 13
- Filament 5
- Livewire 4
- Pest 4
misaf/vendra-supportspatie/laravel-medialibrary
Installation
composer require misaf/vendra-multimedia php artisan vendor:publish --tag=medialibrary-migrations php artisan vendor:publish --tag=vendra-multimedia-migrations php artisan migrate
Set the media model and path generator in config/media-library.php:
'media_model' => \Misaf\VendraMultimedia\Models\Multimedia::class, 'path_generator' => \Misaf\VendraMultimedia\Support\DefaultPathGenerator::class,
Optional translations publish:
php artisan vendor:publish --tag=vendra-multimedia-translations
Usage
Use Spatie Media Library as usual:
$model ->addMedia($pathToFile) ->toMediaCollection('default');
Models can reuse the default conversions:
use Misaf\VendraMultimedia\Concerns\HasDefaultMediaConversions; class Product extends Model implements HasMedia { use HasDefaultMediaConversions; use InteractsWithMedia; }
In Filament, media records are available on the admin panel.
Storage layout
Media is stored under {prefix}/{tenant}/{uuid}/, with conversions and responsive images in conversions/ and responsive-images/ below it. The tenant comes from the media row rather than the current tenant, so paths resolve the same way in the console panel, the CLI, and queued jobs. Media without a tenant keeps the {prefix}/{uuid}/ layout.
Move media stored before the tenant prefix into its tenant directory:
php artisan vendra-multimedia:relocate --dry-run php artisan vendra-multimedia:relocate
Testing
Run the package checks from the project root:
php artisan test --compact --testsuite=vendra-multimedia
composer stan
License
MIT. See LICENSE.