PHPackages                             sukohi/group-wise-filter - 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/group-wise-filter

ActiveLibrary

sukohi/group-wise-filter
========================

A Laravel package to get row(s) with the group-wise maximum or minimum.

2.0.3(10y ago)014MITPHP

Since Mar 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/SUKOHI/GroupWiseFilter)[ Packagist](https://packagist.org/packages/sukohi/group-wise-filter)[ RSS](/packages/sukohi-group-wise-filter/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (9)Used By (0)

GroupWiseFilter
===============

[](#groupwisefilter)

A Laravel package to get row(s) with the group-wise maximum or minimum.

(This is for Laravel 5+. [For Laravel 4.2](https://github.com/SUKOHI/GroupWiseFilter/tree/1.0))

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

[](#installation)

Execute composer command.

```
composer require sukohi/group-wise-filter:2.*

```

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

[](#preparation)

In your model, set GroupWiseFilterTrait.

```
use Sukohi\GroupWiseFilter\GroupWiseFilterTrait;

class Item extends model
{
    use GroupWiseFilterTrait;
}

```

Now you can call `groupMax()` and `groupMin()`.

Usage
=====

[](#usage)

**Simplest Way**

```
$column = 'amount';
$group_by = 'area_id';
$items = \App\Item::groupMax($column, $group_by)->get();

```

**with select(), where() and so on..**

You should add table name like this.

```
$items = \App\Item::select(
                'items.id',
                'items.title'
                'items.area_id'
            );

```

**Order by Group**

```
\App\Item::orderByGroup('ASC');
\App\Item::orderByGroup('DESC');

```

**Grouped table and Grouped table**

You can use `GROUP_TABLE` and `GROUP_VALUE` like this.

```
	$items = \App\Item::select('GROUP_TABLE.GROUP_VALUE');

```

License
=======

[](#license)

This package is licensed under the MIT License.

Copyright 2016 Sukohi Kuhoh

###  Health Score

28

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

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

Total

8

Last Release

3659d ago

Major Versions

1.0.0 → 2.0.12016-03-15

1.0.1 → 2.0.32016-03-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-group-wise-filter/health.svg)

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

PHPackages © 2026

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