PHPackages                             dcodegroup/laravel-dsg-table - 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. dcodegroup/laravel-dsg-table

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

dcodegroup/laravel-dsg-table
============================

Convention-based data tables and filters for DSG Table with a single API endpoint

1.0.1(4w ago)142↓50%MITPHPPHP ^8.2 || ^8.3 || ^8.4

Since Jun 16Pushed 4w agoCompare

[ Source](https://github.com/DCODE-GROUP/laravel-dsg-table)[ Packagist](https://packagist.org/packages/dcodegroup/laravel-dsg-table)[ RSS](/packages/dcodegroup-laravel-dsg-table/feed)WikiDiscussions main Synced 2w ago

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

Laravel DSG Table
=================

[](#laravel-dsg-table)

Convention-based data tables for Laravel, designed to work with [`dsg-vue tables`](https://github.com/DCODE-GROUP/dsg-vue).

Instead of creating a dedicated API controller for every table, this package gives you:

- **One endpoint** that resolves table classes by name
- **Table classes** that define authorisation, query logic, column definitions, and filters
- **Column builders** that output the field arrays expected by `DsgTable`
- **Reusable filter facets** (`BooleanFacet`, `DateRangeFacet`, `SelectFacet`, `RefineFacet`)
- **Row action builders** (`CrudActions`, `RowActions`) configured on table classes
- **Fluent `FilterBuilder`** for composing filter definitions
- **`make:table`** to scaffold new tables quickly

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 10, 11, 12, or 13

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

[](#installation)

```
composer require dcodegroup/laravel-dsg-table
```

Publish the config file:

```
php artisan vendor:publish --tag=dsg-table-config
```

Quick start
-----------

[](#quick-start)

### 1. Register the route

[](#1-register-the-route)

In your API routes file:

```
use Illuminate\Support\Facades\Route;

Route::dsgTable(
    name: 'api.dsg-table',
    middleware: ['api', 'auth:sanctum'],
);
```

This registers two GET endpoints:

```
GET /dsg-table/{tableName}/{param?}
GET /dsg-table/{tableName}/filters/{param?}

```

For example, `GET /dsg-table/users` resolves to `App\Tables\UsersTable`, and `GET /dsg-table/users/filters` returns that table's filter definitions.

Alternatively, set `route.auto_register` to `true` in config and the package will register the route for you using the values in `config/dsg-table.php`.

### 2. Create a table class

[](#2-create-a-table-class)

```
php artisan make:table users
```

This creates `app/Tables/UsersTable.php`:

```
