PHPackages                             sukohi/smoothness - 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. sukohi/smoothness

ActiveLibrary

sukohi/smoothness
=================

Your package description here.

4.0.6(9y ago)012.2k1PHP

Since Apr 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SUKOHI/Smoothness)[ Packagist](https://packagist.org/packages/sukohi/smoothness)[ RSS](/packages/sukohi-smoothness/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (25)Used By (1)

Smoothness
==========

[](#smoothness)

A Laravel package to manage WHERE clause.
(This is for Laravel 5+. [For Laravel 4.2](https://github.com/SUKOHI/Smoothness/tree/3.0))

[Demo](http://demo-laravel52.capilano-fw.com/smoothness)

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

[](#installation)

Execute composer command.

```
composer require sukohi/smoothness:4.*

```

Preparation
===========

[](#preparation)

At first, set `SmoothnessTrait` in your Model.

```
use Sukohi\Smoothness\SmoothnessTrait;

class Item extends Eloquent {

    use SmoothnessTrait;

}

```

Secondary, add configuration values also in your Model.

**columns:** keys and column names you want to use. (Required)
**labels:** Labels and keys you want to use. (Optional)
**condition:** Condition type which are and &amp; or (Optional, Default: auto)

```
protected $smoothness = [
	'columns' => [
		'search_id' => 'id',
		'search_title' => 'title',
		'search_date' => 'created_at'
	],
	'labels' => [
		'search_id' => 'ID',
		'search_title' => 'Item Title',
		'search_date' => 'Date'
	],
	'condition' => 'and'
];

```

**Note:** If you set `auto` in `condition`, you can change condition value through URL params like this.

**Query Scope:** You also can utilize `Query Scopes` instead of column name.

```
'columns' => [
    'scope_title' => 'scope::filterTitle'
],

```

in this case, you need to prepare a scope method in your model. ([About Query Scopes](https://laravel.com/docs/4.2/eloquent#query-scopes))

```
public function scopeFilterTitle($query, $value) {

    return $query->where('title', $value);

}

```

**Label** You can use `label::` prefix to call a specific method.

```
'labels' => [
    'title' => 'label::filterTitle'
],

```

in this case, you need to prepare a method in your model.

```
public function labelFilterTitle() {

    return 'Your Title'.

}

```

(You may use this tip for switching locale and so on.)

Usage
=====

[](#usage)

Now you can use a method called `smoothness`.

(in Controller)

```
$items = Item::smoothness()->get();

```

After call `smoothness()`, you can access to sort data through `$smoothness`.

(in View)

**condition:** Current condition. `and` &amp; `or`.

```
Condition: {{ $smoothness->condition }}

```

**values:** Submitted data.

```
@foreach($smoothness->values as $key => $value)

@endforeach

or

$smoothness->values->get('KEY_NAME');

```

**has\_values:** Submitted data that has value.

```
@foreach($smoothness->has_values as $column => $value)
    {{ $column }} => {{ $value }}
@endforeach

or

$smoothness->has_values->get('KEY_NAME');

```

**labels:** Array values of columns that has value.

```
@foreach($smoothness->labels as $key => $label)
    {{ $label }}
@endforeach

```

**conditions:** Array values of columns that has value.

```
@foreach($smoothness->conditions as $key => $boolean)
    {{ ($key == 'and') ? 'And' : 'Or' }}
@endforeach

```

**appends:** Array values for pagination

```
{{ $items->appends($smoothness->appends)->links() }}

```

Change condition
================

[](#change-condition)

The 1st argument is for setting condition type.

```
Item::smoothness('or')->get();

```

Relationship
============

[](#relationship)

You can use this package with relationship using join().

(in Controller)

```
$items = Item::join('item_details', 'item_details.item_id', '=', 'items.id')
            ->smoothness()
            ->paginate(5);

```

(in Model)

```
protected $smoothness = [
	'columns' => [
		'items.id' => 'ID',
		'items.title' => 'Title',
		'items.created_at' => 'Date',
		'item_details.address' => 'Address'
	]
];

```

License
=======

[](#license)

This package is licensed under the MIT License.

Copyright 2016 Sukohi Kuhoh

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity73

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 ~4 days

Recently: every ~12 days

Total

24

Last Release

3595d ago

Major Versions

3.0.2 → 4.0.12016-04-18

3.0.4 → 4.0.22016-04-18

3.0.5 → 4.0.32016-04-18

3.0.6 → 4.0.42016-04-18

3.0.x-dev → 4.0.52016-05-25

### 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-smoothness/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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