- How do I install torann/mediasort in a Laravel application?
- Install it with Composer using composer require torann/mediasort, then publish the package configuration with php artisan vendor:publish and select the MediaSort provider tag. Laravel's package auto-discovery should register the service provider, but if you have discovery disabled you will need to add the provider and any facade manually. After publishing, review the generated config file before writing any ordering logic so you know which table, column, and grouping options the package expects.
- Which Laravel versions does torann/mediasort support?
- The published documentation does not state a clear Laravel version matrix, and the most recent release referenced is 2.0.9, so you should check the illuminate/support constraint inside the package's composer.json before assuming compatibility. There is no community evidence of the package being exercised against Laravel 11 or 12, so treat support as unproven until you verify it yourself. Run a short pilot on your target Laravel version and pin the exact release in composer.json rather than relying on a floating constraint.
- How does torann/mediasort persist the position of media items?
- The package is described as persisting user-defined positions for images, files, and other media records so collections render in a deliberate sequence rather than insertion order. In practice this usually means an integer or sortable position attribute stored against each media record, with reorder operations rewriting those values inside a transaction. Because the available documentation is inconsistent, confirm in vendor/torann/mediasort/src whether it manages Eloquent records, moves files on disk, or does both, before you design your schema around it.
- Can I use torann/mediasort to power drag-and-drop image reordering in a CMS?
- Yes, that is the intended workflow: you handle the drag-and-drop interaction in the browser with a library such as SortableJS and send the resulting ordered list of IDs to your own controller. The package's job is the server-side half, accepting that order and writing the new positions so the sequence survives a page reload. Do not expect it to ship front-end JavaScript assets, CSS, or a ready-made Vue or React component; the UI layer is yours to build.
- Does torann/mediasort support separate sortable collections or galleries?
- The package advertises configurable sortable collections and groups, which lets you scope ordering so each gallery, album, or product keeps an independent sequence instead of sharing one global order. That scoping is normally expressed as a group key or parent relation stored alongside the position value. Test the behaviour with two overlapping collections early, since off-by-one and duplicate position bugs in scoped reordering are the most common failure mode in this class of package.
- Is torann/mediasort compatible with Spatie Media Library or other media managers?
- Nothing in the documentation confirms an integration, and the answer depends entirely on which product the package actually is. If it only stores a position column on your own model, it can coexist with Spatie Media Library as long as you add the ordering attribute to the media model yourself. If it also relocates files on disk, running it alongside another component that owns media storage will cause layout drift, so read the source before combining them.
- Is torann/mediasort actively maintained and safe to use in production?
- Adoption is very low, with roughly twenty GitHub stars, no dependents, and a single maintainer under a BSD-2 licence, and no security policy is published. The mitigating factor is blast radius: the codebase is small and permissively licensed, so forking it is a realistic exit if the maintainer disappears. Pin a specific version, wrap the calls behind your own service class, and avoid letting package internals spread across your controllers.
- The torann/mediasort documentation seems contradictory, is it a sorter or a file organizer?
- That ambiguity is real and documented: the package blurb describes a rule-based media organizer that reads capture metadata and moves files into folder structures, while the feature list describes persisted sortable positions and drag-and-drop reordering. These are different capabilities that would require different integration work and different data models. Before writing any code, spend time in vendor/torann/mediasort/src to confirm which one the installed version actually implements.
- What are the alternatives to torann/mediasort for sortable media in Laravel?
- For a pure ordering concern, spatie/eloquent-sortable is far better adopted and gives you a sortable trait with scoped grouping and reorder helpers, and Spatie Media Library covers storage plus an order column if you need both. If your requirement is really automatic file placement by extension, MIME type, or metadata, you are better served by a filesystem callback in your own upload pipeline than by a low-adoption package. Rolling your own integer position column with a unique composite index is also a defensible option for small projects.
- How should I test media reordering with torann/mediasort in my Laravel app?
- Write feature tests that post a shuffled ID list to your reorder endpoint and then assert the exact stored position and retrieval order of every record, not just the first one. Add a test for the scoped case with two collections to prove they do not interfere, and a test for concurrent submissions if two editors can reorder the same collection. Also assert that a failed reorder leaves positions unchanged, which catches missing transaction boundaries.