PHPackages                             sukohi/caruta - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sukohi/caruta

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sukohi/caruta
=============

A PHP package mainly developed for Laravel to generate sort link(s).

2.0.1(10y ago)23472MITPHP

Since Aug 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/SUKOHI/Caruta)[ Packagist](https://packagist.org/packages/sukohi/caruta)[ RSS](/packages/sukohi-caruta/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

Caruta
======

[](#caruta)

A PHP package mainly developed for Laravel to generate sort link(s).
(This is for Laravel 5+. [For Laravel 4.2](https://github.com/SUKOHI/Caruta/tree/1.0))

[![alt text](https://camo.githubusercontent.com/e503ea4e6c641a222f18447ed74ec90a58a45dee8b74caf669d338c03e10e3a7/687474703a2f2f692e696d6775722e636f6d2f715438546a4a6e2e706e67)](https://camo.githubusercontent.com/e503ea4e6c641a222f18447ed74ec90a58a45dee8b74caf669d338c03e10e3a7/687474703a2f2f692e696d6775722e636f6d2f715438546a4a6e2e706e67)[![alt text](https://camo.githubusercontent.com/4f2b0a0e25cb282840ff9032d1fafdb036ab59e135f2398deef8ee7cce2031f6/687474703a2f2f692e696d6775722e636f6d2f355265725253412e706e67)](https://camo.githubusercontent.com/4f2b0a0e25cb282840ff9032d1fafdb036ab59e135f2398deef8ee7cce2031f6/687474703a2f2f692e696d6775722e636f6d2f355265725253412e706e67)

Installation
============

[](#installation)

Add this package name in composer.json

```
"require": {
  "sukohi/caruta": "2.*"
}

```

Execute composer command.

```
composer update

```

Register the service provider in app.php

```
'providers' => [
    ...Others...,
    Sukohi\Caruta\CarutaServiceProvider::class,
]

```

Also alias

```
'aliases' => [
    ...Others...,
    'Caruta'   => Sukohi\Caruta\Facades\Caruta::class
]

```

Usage
=====

[](#usage)

**Minimal way**

```
{{ \Caruta::links('your-column-name') }}

```

(example)
[![alt text](https://camo.githubusercontent.com/e503ea4e6c641a222f18447ed74ec90a58a45dee8b74caf669d338c03e10e3a7/687474703a2f2f692e696d6775722e636f6d2f715438546a4a6e2e706e67)](https://camo.githubusercontent.com/e503ea4e6c641a222f18447ed74ec90a58a45dee8b74caf669d338c03e10e3a7/687474703a2f2f692e696d6775722e636f6d2f715438546a4a6e2e706e67)

**with Options**

```
echo \Caruta::url('http://example.com')
    ->text('&#8593;', '&#8595;')
    ->appends([
		'key1' => 'value1',
		'key2' => 'value2',
		'key3' => 'value3'
	])
	->keys('order', 'direction')
	->links('column_name', $separator = '');

```

- All methods except links() are optional. See [methods](#methods)

**Single Text Way**

If you set the third argument like the below, only one link will be displayed.

```
\Caruta::text(
    '',
    '',
    ''
);

```

(example)

[![alt text](https://camo.githubusercontent.com/4f2b0a0e25cb282840ff9032d1fafdb036ab59e135f2398deef8ee7cce2031f6/687474703a2f2f692e696d6775722e636f6d2f355265725253412e706e67)](https://camo.githubusercontent.com/4f2b0a0e25cb282840ff9032d1fafdb036ab59e135f2398deef8ee7cce2031f6/687474703a2f2f692e696d6775722e636f6d2f355265725253412e706e67)

**Sort with model**
With model(Eloquent), you can automatically set "ORDER BY" like the below.

```
$items = \App\Item::select('id', 'title');
$items = \Caruta::sort($items,
    ['id', 'title', 'created_at'],
    ['updated_at', 'asc']
);
dd($items->get()->toArray());

```

- The second argument(Array) means that except specific column name(s) will be ignored to set "ORDER BY" for secure.
- The third argument(Array) will be used for default. And direction canbe `asc` and `desc`

**Note:** If you changed the parameter name "ORDER BY" to other using keys() method, you also need to set it in this case as well.

Methods
==========================================

[](#methods)

- url($url)

`$url` is base URL that will be included in `href` property.

- text($one, $two)

`$one` and `$two` are text that will be included in link tag.

e.g. &lt;a href="\*\*\*\*"&gt;YOUR-TEXT&lt;/a&gt;

- appends($values)

`$values` is additional values that you want to include in link URL.

e.g. [http://example.com?orderby=\*\*\*\*\*&amp;direction=asc&amp;YOUR-KEY=YOUR-VALUE](http://example.com?orderby=*****&direction=asc&YOUR-KEY=YOUR-VALUE)

License
=======

[](#license)

This package is licensed under the MIT License.

Copyright 2014 Sukohi Kuhoh

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

6

Last Release

3916d ago

Major Versions

1.0.0 → 2.0.02015-08-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/2980d59b309d45df3f2e6e51b1d336614da063240b8f76f873f287cd745ec5db?d=identicon)[Sukohi](/maintainers/Sukohi)

---

Top Contributors

[![SUKOHI](https://avatars.githubusercontent.com/u/5362394?v=4)](https://github.com/SUKOHI "SUKOHI (1 commits)")

### Embed Badge

![Health badge](/badges/sukohi-caruta/health.svg)

```
[![Health](https://phpackages.com/badges/sukohi-caruta/health.svg)](https://phpackages.com/packages/sukohi-caruta)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
