Weave Code
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

Column Sortable Laravel Package

kyslik/column-sortable

Add sortable table columns to Laravel (5.5–8) Eloquent listings. Provides Blade helpers to generate sort links with direction icons, supports configurable sortable fields, pagination-friendly URLs, and sorting on hasOne/belongsTo relations with optional aliases.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature Development: Enables seamless, user-driven column sorting in Laravel-based admin panels, dashboards, or data-heavy applications (e.g., CRM, SaaS platforms, analytics tools). Reduces frontend complexity by offloading sorting logic to the backend.
  • Roadmap Prioritization: Justifies investment in self-service data exploration for power users (e.g., analysts, support teams) without requiring custom backend development per feature.
  • Build vs. Buy: Buy—avoids reinventing sorting logic (e.g., pagination + dynamic ORDER BY clauses) while supporting complex use cases like:
    • Relation sorting (e.g., sorting users by their addresses.city via belongsTo/hasOne).
    • Custom joins (override default behavior for nested queries).
    • Aliased columns (e.g., SELECT name AS username → sort by username).
  • Use Cases:
    • Admin panels: Sort tables by any column (e.g., orders by created_at, total_price).
    • Public-facing tools: Let users sort search results (e.g., e-commerce filters, directory listings).
    • Legacy system modernization: Add sorting to existing Laravel apps with minimal refactoring.

When to Consider This Package

  • Adopt if:

    • Your Laravel app (5.5–10.x) requires dynamic column sorting with minimal frontend JS.
    • You need to support relation-based sorting (e.g., sort posts by author.name).
    • Your team lacks bandwidth to build custom sorting logic (e.g., handling sort=column:direction in routes/controllers).
    • You’re using Eloquent models and want to avoid raw SQL in queries.
    • Your UI framework (e.g., Blade, Livewire) needs consistent sorting icons (Font Awesome integration).
  • Look elsewhere if:

    • You’re using Laravel 11+ exclusively (package lags behind; check for forks or alternatives like spatie/laravel-query-builder).
    • Your sorting needs client-side only (e.g., React/Vue apps with API-driven sorting).
    • You require multi-column sorting (e.g., sort by name ASC, date DESC simultaneously)—this package handles single-column sorts.
    • Your database schema is highly dynamic (e.g., columns added/removed at runtime); the package assumes static $sortable arrays.
    • You need sorting for non-Eloquent queries (e.g., raw DB connections).

How to Pitch It (Stakeholders)

For Executives:

"This package lets users sort data in our Laravel apps with a single click—no dev work required. For example, support teams can instantly sort tickets by priority or created_at without us writing custom backend logic. It’s a low-code way to add self-service data exploration to admin panels or public tools, reducing support requests and speeding up feature delivery. The MIT license and 600+ stars mean it’s battle-tested and maintainable."

ROI:

  • Dev time saved: Eliminates 2–4 hours of work per sorting feature.
  • User experience: Empowers non-technical users to analyze data their way.
  • Scalability: Supports complex queries (relations, joins) out of the box.

For Engineering:

*"This is a drop-in Laravel package that handles dynamic column sorting for Eloquent models. Key benefits:

  • Blade directive (@sortablelink) generates sorted links with icons (Font Awesome).
  • Zero frontend JS: Sorting is handled via Laravel query scopes.
  • Relation support: Sort by user.name or post.category.title using Eloquent relations.
  • Customizable: Override default behavior for complex joins or aliased columns.
  • Future-proof: Actively maintained (last release: 2026), with Laravel 12/13 support.

Implementation:

  1. Add to composer.json and publish config.
  2. Use use Sortable trait in models + define $sortable = ['column1', 'column2'].
  3. Replace manual orderBy() with $model->sortable()->paginate().
  4. Use @sortablelink('column') in Blade for UI.

Trade-offs:

  • Single-column sorts only (no sort=col1:asc,col2:desc).
  • Requires Eloquent models (not raw queries).
  • Font Awesome dependency for icons (configurable).

Alternatives considered:

  • Roll our own: Would take 1–2 dev days to build; this package is tested and maintained.
  • Frontend sorting: Adds latency and complexity for server-side data.
  • Spatie’s query builder: Overkill for simple sorting needs.

Recommendation: Adopt for admin panels/dashboards. Pair with Livewire/Alpine for reactive UIs if needed."*

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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui