PHPackages                             vivre-tech/rest-grid - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. vivre-tech/rest-grid

ActiveYii2-extension[HTTP &amp; Networking](/categories/http)

vivre-tech/rest-grid
====================

For Yii2: This extension provides the ability like GridView but for REST.

1.0.3(8y ago)412.6k↓38.2%1MITPHPPHP &gt;=5.5

Since Jan 5Pushed 8y ago3 watchersCompare

[ Source](https://github.com/VivreTech/rest-grid)[ Packagist](https://packagist.org/packages/vivre-tech/rest-grid)[ RSS](/packages/vivre-tech-rest-grid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

This extension provides the ability like GridView but for REST.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/a96cef0967deb37628427f5e6f6796d232d1b14ce09abf0874a53f393a6e1901/68747470733a2f2f706f7365722e707567782e6f72672f76697672652d746563682f726573742d677269642f762f737461626c652e706e67)](https://packagist.org/packages/vivre-tech/rest-grid)[![Total Downloads](https://camo.githubusercontent.com/f6b9f0383663ff9acc2cfcf04b1830cf345b1884a379c43405638534a97e4611/68747470733a2f2f706f7365722e707567782e6f72672f76697672652d746563682f726573742d677269642f646f776e6c6f6164732e706e67)](https://packagist.org/packages/vivre-tech/rest-grid)[![Build Status](https://camo.githubusercontent.com/50c9bd1fa466a891802af43b6726e46ece7a4c0f7c58778ac3f76dea2e4a94f5/68747470733a2f2f7472617669732d63692e6f72672f76697672652d746563682f726573742d677269642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vivre-tech/rest-grid)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist vivre-tech/rest-grid

```

or add

```
"vivre-tech/rest-grid": "*"
```

to the require section of your composer.json.

Usage
-----

[](#usage)

Example:

```
$arrayRows = [];
foreach(range(1, 100) as $item) {
    $arrayRows[] = [
        'id' => $item,
        'name' => 'Product ' . $item,
        'price' => 100 + $item,
        'created_at' => date('Y-m-d H:i:s')
    ];
}

$dataProvider = new \yii\data\ArrayDataProvider([
    'allModels' => $arrayRows,
    'pagination' => [
        'pageSize' => 5,
    ],
]);

$grid = new \vivretech\rest\grid\Grid([
    'dataProvider' => $dataProvider,
    'columns' => [
        [
            'attribute' => 'id'
        ],
        [
            'attribute' => 'name'
        ],
        [
            'attribute' => 'price'
        ],
        [
            'attribute' => 'created_at'
        ]
    ]
]);

return $grid->run();
```

Response
--------

[](#response)

```
{
    "metadata": {
        "id": "aa899d9e6e420821e20f04ea857e0c2d_0",
        "caption": null,
        "description": null,
        "options": [],
        "header": {
            "show": true
        },
        "filters": {
            "show": true
        },
        "footer": {
            "show": false
        },
        "request_params": {
            "pager": {
                "param": "page",
                "size": "per-page"
            },
            "sorter": {
                "param": "sort",
                "separator": ",",
                "multi_sort": false
            }
        }
    },
    "pager": {
        "results": {
            "total": 1212,
            "per_page": 5
        },
        "pages": {
            "total": 243,
            "current": 1
        }
    },
    "columns": [
        {
            "label": "Id",
            "attribute": "id",
            "description": null,
            "options": [],
            "sortable": true,
            "filterable": false,
            "header": {
                "value": [],
                "options": []
            },
            "filter": {
                "selected": null,
                "items": [],
                "options": []
            },
            "footer": {
                "value": [],
                "options": []
            }
        },
        {
            "label": "Name",
            "attribute": "name",
            "description": null,
            "options": [],
            "sortable": true,
            "filterable": false,
            "header": {
                "value": [],
                "options": []
            },
            "filter": {
                "selected": null,
                "items": [],
                "options": []
            },
            "footer": {
                "value": [],
                "options": []
            }
        },
        {
            "label": "Price",
            "attribute": "price",
            "description": null,
            "options": [],
            "sortable": true,
            "filterable": false,
            "header": {
                "value": [],
                "options": []
            },
            "filter": {
                "selected": null,
                "items": [],
                "options": []
            },
            "footer": {
                "value": [],
                "options": []
            }
        },
        {
            "label": "Created At",
            "attribute": "created_at",
            "description": null,
            "options": [],
            "sortable": true,
            "filterable": false,
            "header": {
                "value": [],
                "options": []
            },
            "filter": {
                "selected": null,
                "items": [],
                "options": []
            },
            "footer": {
                "value": [],
                "options": []
            }
        }
    ],
    "items": [
        {
            "id": 1,
            "name": "Product 1",
            "price": 101,
            "created_at": "2018-04-02 17:54:52"
        },
        {
            "id": 2,
            "name": "Product 2",
            "price": 102,
            "created_at": "2018-04-02 17:54:52"
        },
        {
            "id": 3,
            "name": "Product 3",
            "price": 103,
            "created_at": "2018-04-02 17:54:52"
        },
        {
            "id": 4,
            "name": "Product 4",
            "price": 104,
            "created_at": "2018-04-02 17:54:52"
        },
        {
            "id": 5,
            "name": "Product 5",
            "price": 105,
            "created_at": "2018-04-02 17:54:52"
        }
    ]
}
```

Unit Testing
------------

[](#unit-testing)

If you run the following command: `composer install` in a dev environment then you will find `phpunit` in `/vendor/bin/phpunit`.

In case `phpunit` in not installed via command `composer install`, just fallow next steps:

1. run in console/terminal `brew install phpunit`

To test, in the `root` of the project, base on how `phpunit` is installed you will have two choices to run:

1. installed via command `composer install` you will have to execute in console/terminal: `vendor/bin/phpunit`
2. installed via `brew` you will have to execute in console/terminal: `phpunit`

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

2968d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4

1.0.3PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/327b21f2438fba2a3f8b19c9b4cc667773a62b6fa0e61216d38f45d9d4464014?d=identicon)[microThread](/maintainers/microThread)

---

Top Contributors

[![microThread](https://avatars.githubusercontent.com/u/4279940?v=4)](https://github.com/microThread "microThread (7 commits)")

---

Tags

apirestgridyii2rest-grid

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vivre-tech-rest-grid/health.svg)

```
[![Health](https://phpackages.com/badges/vivre-tech-rest-grid/health.svg)](https://phpackages.com/packages/vivre-tech-rest-grid)
```

###  Alternatives

[hiqdev/yii2-hiart

ActiveRecord for API

5951.8k3](/packages/hiqdev-yii2-hiart)

PHPackages © 2026

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