- How do I install elegantly/laravel-media?
- Install it with composer require elegantly/laravel-media, then publish the package config and migrations and run php artisan migrate. Add the package's media trait to any Eloquent model that should own uploads. The package owns its own media table, so existing tables only need polymorphic keys rather than schema changes.
- Can I attach multiple media files and named collections to an Eloquent model?
- Yes. You can define named media collections and attach either a single file or multiple files to an Eloquent model through a fluent API. Because the relation is polymorphic, the same trait can be applied to several models in one application.
- Which Laravel and PHP versions does elegantly/laravel-media support?
- The authoritative answer is the illuminate/* and PHP constraints in the package's composer.json. It is a conventional Laravel package built around Eloquent and filesystem disks, but Laravel 10, 11, and 12 compatibility should be verified against your lockfile before adoption. Also check whether image conversion pulls Intervention Image v2 or v3, since that is a common Composer resolution conflict.
- How does elegantly/laravel-media compare to spatie/laravel-medialibrary?
- It is a direct functional substitute for spatie/laravel-medialibrary: the same problem of attaching many files to many models, generating conversions, and managing disks. The feature surface is comparable, but the ecosystem exposure is far smaller, with few stars and no public dependents. Choose it when the fluent API and configuration fit your needs; choose Spatie when you need a large production base and third-party examples.
- Does elegantly/laravel-media support image conversions and nested conversions?
- Yes. The package supports image conversions and advanced nested media conversions, allowing derived renditions from stored media. Conversion definitions are registered through configuration, and you should confirm whether conversions run synchronously or are queued in your setup. Nested conversions are useful for responsive variants, but validate the generated paths and disk usage.
- Can I store media on S3, GCS, or a local disk?
- Yes. elegantly/laravel-media is built on Laravel's filesystem abstraction and supports diverse disks, including local, S3, and GCS-style storage. You configure the default disk and per-collection disk mappings in the published config. Path generation is customizable, so review the defaults for public versus private visibility.
- How does the package handle metadata extraction and custom properties?
- The package performs rich metadata extraction and lets you store custom properties alongside each media item. Metadata such as dimensions, MIME type, and size can be read from the media model, while custom properties cover application-specific fields. Treat extracted EXIF and SVG metadata as untrusted input when rendering.
- Is elegantly/laravel-media production-ready, and what upload security should I audit?
- Treat that as an audit item rather than an assumption. With roughly 49 stars and no observable dependents, you would be an early production canary, so review the test suite, CI matrix, and maintainer history. Specifically audit MIME and extension validation, size limits, SVG handling, default disk visibility, and whether conversions are queued. Pin the version and wrap the package behind your own service boundary if media is load-bearing.
- How should I test media uploads and conversions in my Laravel test suite?
- Use Laravel's Storage::fake() for the configured disk and assert that media records and files are created through your upload endpoints. Test single and multiple collection uploads, conversion generation, and authorization policies around attaching or deleting media. If conversions are queued, use Queue::fake() or run the queue worker in the test to verify derived files.
- Does it clean up files when a model is deleted, and is there a prune command?
- The package manages original files and derived renditions, but you should verify delete and soft-delete cleanup behavior in your version before relying on it. Check whether deleting a model removes its media records and disk files, and whether a prune command exists for orphaned files. If not, add a scheduled cleanup job and test it against your storage disk.