Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Eloquent Sortable Laravel Package

oddvalue/eloquent-sortable

A Laravel package that adds sortable behavior to Eloquent models. Use a simple trait to assign and maintain custom order, move records up or down, and reorder items reliably—great for drag-and-drop lists, menus, and other ordered content.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Green-lighting "user-defined ordering" as an epic. Any roadmap item that says drag to reorder, arrange my dashboard, curate this collection, pin to top, or custom menu order reduces to the same primitive: an integer position column on a flat, optionally grouped list. This package is the buy-side answer to that primitive and turns a multi-sprint story into a one-to-two-sprint story (schema + backfill, transactional endpoint, UI).
  • Build vs. buy on ordering mechanics. Building reordering in-house means owning position math, gap/duplicate handling, cross-group moves, and delete-renumbering forever. Buying it here means owning only the policy layer: who can reorder, when it's allowed, how conflicts are surfaced. That is the correct place for product to spend attention.
  • Scoping of concrete features. Directly enables: manual ordering of CMS content blocks, featured/homepage rails, form field order, task/subtask order within a list, gallery and media ordering, per-category product merchandising, saved-view and sidebar ordering. It does not enable hierarchical menus, nested categories, or cross-entity ordering — those need a separate tree/nested-set decision and should be scoped as a distinct epic, not assumed to ride along.
  • Prioritization input. Because a reorder is O(n) in group size and needs a transactional endpoint plus an index, "reordering" is cheap for small curated lists (dozens to hundreds of rows per group) and becomes an infrastructure conversation at tens of thousands of rows per group. That is a useful forcing function for which lists get manual ordering in v1 versus which stay on default sort (recency, rank score, popularity).
  • Roadmap sequencing constraint. The UI is the cheap part; the endpoint and data invariants are the real work. Any roadmap that promises drag-and-drop should sequence schema/backfill → transactional reorder API → UI, and should refuse to ship the UI first.
  • Compatibility and platform decisions. Adoption forces an explicit answer to "are we on a supported Laravel/PHP version, and do we tolerate a single-maintainer utility with community-only support?" That is a platform-standards question worth making once, explicitly, rather than re-litigating per feature.
  • Non-decisions it protects. No new service, no infrastructure, no on-call surface, no vendor contract, no procurement. This is a dependency-level decision that product can delegate to engineering once the use cases are confirmed — it does not need a business case or budget line.

When to Consider This Package

Consider it when all of these hold:

  • The ordering need is a flat list, optionally scoped by a group (per category, per tenant, per user, per parent record). Scoped sorting is the reason to prefer this over a hand-rolled column.
  • Expected group sizes are hundreds to low tens of thousands of rows. Below that, the O(n) move cost is invisible. Above that, you want sparse ordering or a dedicated position table, and this package alone will not carry you.
  • Your stack is standard Laravel/Eloquent and the team already owns migrations and models. Integration is a trait plus a column — minimal blast radius, easy to wrap.
  • You can commit to the non-negotiables: a composite index on (group, order), a single transactional reorder endpoint behind authorization, and a periodic integrity check for duplicate/gapped positions.
  • You are willing to put a thin service wrapper between your domain code and the trait, so replacing the package later is a contained change rather than a refactor.
  • You accept community-only support and a likely single-maintainer bus factor for a small utility trait whose failure mode is scoped to ordering, not availability.

Look elsewhere when:

  • The feature is genuinely hierarchical — menus with nesting, category trees, arbitrary reparenting. This solves ordering, not structure; you would need a second mechanism and should pick a tree package first.
  • You need cross-entity or global ordering across heterogeneous records. Group scoping is per-column on one model; mixing types is your problem to solve.
  • Lists will routinely exceed tens of thousands of rows per group, or reordering is a frequent, concurrent, hot-path operation (e.g. a shared global leaderboard). Lock contention and deadlock retries become product-visible bugs.
  • Your data is imported or edited out-of-band at volume and you cannot enforce "all writes go through the wrapper." Application-level uniqueness means direct SQL silently corrupts ordering, and you would be building an integrity-check-and-repair system, not a reordering feature.
  • The roadmap needs collaborative or multi-user reordering with conflict resolution UX — that is a product problem the package does not touch.
  • Zero-dependency or audited-vendor policies apply. Two GitHub stars, community-only support, no SLA, and a CI-only release do not clear a procurement bar.
  • A supported platform path for your Laravel/PHP target cannot be confirmed from composer.json. Verify before committing; the changelog will not tell you.

How to Pitch It (Stakeholders)

One line. A small, free, MIT-licensed Laravel add-on that lets users drag their own lists into the order they want — menus, galleries, content blocks, per-category products — without us building and maintaining the ordering mechanics ourselves.

To executives. This is a buy-not-build call on a commodity mechanic, not a platform bet. It converts a recurring "can users reorder this?" request from a multi-sprint build into a short, repeatable pattern we can apply per list. Cost is effectively zero: one open-source dependency, no vendor contract, no new infrastructure, no on-call. The trade-offs are that it covers flat lists only (nested menus are a separate decision), that it has essentially no community around it so we keep a one-day escape hatch, and that we take on a small amount of data-integrity discipline in exchange for the saved build. The team has specified the guardrails — an index, a single transactional reorder endpoint, a periodic integrity check — and with those in place the risk is contained to "the order looks wrong," not "the site is down."

To engineering leads. Integration is a trait and an ordering column; no bindings, no config, no schema surprises, so the blast radius is the models we opt into. The package supplies primitives; we supply the invariants. Required from us before the first UI ships: a composite index on (group, order), a backfill strategy for existing rows, a ReorderService that wraps every move in a transaction with row locking and is the only sanctioned write path, a dedicated authorized endpoint that takes a target position or neighbour rather than a full client array, and an integrity check to catch duplicates or gaps from concurrent writes or imports. The latest release is CI-only — four Dependabot bumps, no source or API changes — so upgrading is a lockfile change; pin ^2.2.0, commit the lock, and treat it as patch-level auto-merge once our wrapper tests are green. Open questions we still need answered from composer.json and a spike, not the changelog: supported Laravel/PHP versions, UUID/ULID primary key support, and cross-group move behavior. Budget roughly half a day to productivity for a mid-level Laravel engineer, and one page of documentation on the ordering invariants so the second engineer does not re-derive them. Keep the wrapper's reorder tests in CI — they are our canary for a silent break on a Laravel major upgrade and for any upstream abandonment.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings