PHPackages                             syamsoul/laravel-datatable-ssp - 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. syamsoul/laravel-datatable-ssp

ActiveLaravel-package[Utility &amp; Helpers](/categories/utility)

syamsoul/laravel-datatable-ssp
==============================

DataTable SSP for Laravel. This package allows you to manage your DataTable from server-side in Laravel app.

3.11.0(2mo ago)744.6k—5%61MITPHPPHP &gt;=8.0.0

Since Mar 21Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/syamsoul/laravel-datatable-ssp)[ Packagist](https://packagist.org/packages/syamsoul/laravel-datatable-ssp)[ RSS](/packages/syamsoul-laravel-datatable-ssp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (81)Used By (1)

DataTable SSP (PHP) for Laravel
===============================

[](#datatable-ssp-php-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a23809f39bf47345797cf32c757af302572fe9b5fe50bf6aab0192511e3f42f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7379616d736f756c2f6c61726176656c2d646174617461626c652d7373702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/syamsoul/laravel-datatable-ssp)[![Total Downloads](https://camo.githubusercontent.com/79f91f5bb30d5c5482f367eb593d04a790cbc44122d2b5ea5bff9c03c0b6e6e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7379616d736f756c2f6c61726176656c2d646174617461626c652d7373702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/syamsoul/laravel-datatable-ssp)[![License](https://camo.githubusercontent.com/79f88d6c2efd5004745ffd8e7f69cf61a426fb4680c4a03092483ac935510a7d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7379616d736f756c2f6c61726176656c2d646174617461626c652d7373702e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Laravel](https://camo.githubusercontent.com/263b2bea7e167badfab23bd4434a5f2db93dd63bb7eb71dea1275ebca3a09ba2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e782532422d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![PHP](https://camo.githubusercontent.com/0668a226279d709a340dcab585c7c6bf5b728cbe1927ec2b14d025098fbf56aa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d626c75652e7376673f7374796c653d666c61742d737175617265)](https://php.net)

Documentation, Installation and Usage Instructions
--------------------------------------------------

[](#documentation-installation-and-usage-instructions)

See the [documentation](https://info.souldoit.com/projects/laravel-datatable-ssp) for detailed installation and usage instructions.

Introduction
------------

[](#introduction)

This package allows you to manage your DataTable from server-side in Laravel app (inspired by [original DataTable SSP](https://github.com/DataTables/DataTablesSrc/blob/master/examples/server_side/scripts/ssp.class.php)).

You can refer [here (click here)](https://datatables.net/examples/data_sources/server_side) about the implementation of original DataTable SSP.

- [Requirement](#requirement)
- [Installation](#installation)
- [Usage &amp; Reference](#usage--reference)
- [How to use it?](#how-to-use-it)
- [Example](#example)
- [In PHP (Controller)](#in-php-controller)
- [In Blade (Views)](#in-blade-views)

Requirement
-----------

[](#requirement)

- Laravel 9.0 and above

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

[](#installation)

This package can be used in Laravel 9.0 or higher. If you are using an older version of Laravel, there's might be some problem. If there's any problem, you can [create new issue](https://github.com/syamsoul/laravel-datatable-ssp/issues) and I will fix it as soon as possible.

You can install the package via composer:

```
composer require syamsoul/laravel-datatable-ssp
```

 ***NOTE***: Please see [CHANGELOG](CHANGELOG.md) for more information about what has changed recently.

Usage &amp; Reference
---------------------

[](#usage--reference)

\* Before you read this section, you can take a look [the example below](#example) to make it more clear to understand.

### How to use it?

[](#how-to-use-it)

First, you must add this line to your Controller:

```
use SoulDoit\DataTable\SSP;
```

And then inject SSP service to Controller's method (or create instance using PHP `new` keyword):

```
use SoulDoit\DataTable\SSP;

class MyController extends Controller
{
    public function get(SSP $ssp)
    {
        // or using `new` keyword:
        // $ssp = new SSP();

        $ssp->setColumns($dt_cols_opt);

        $ssp->setQuery($dt_query);

        return $ssp->response()->json();
    }
}
```

Which is:

- `$dt_query` is a QueryBuilder/EloquentBuilder or callable function that will return QueryBuilder/EloquentBuilder, for example:

    ```
    $ssp->setQuery(function ($selected_columns) {
        return \App\Models\User::select($selected_columns);
    });
    ```
- `$dt_cols_opt` is an array of your columns' options, for example:

    ```
    $ssp->setColumns([
        ['label'=>'ID',         'db'=>'id',            'formatter' => function ($value, $model) {
            return str_pad($value, 5, '0', STR_PAD_LEFT);
        }],
        ['label'=>'Username',   'db'=>'uname'],
        ['label'=>'Email',      'db'=>'email'],
    ]);
    ```

    The available columns' options are as below:

    ```
    [
        'label'         => $dt_col_header,
        'db'            => $db_col_name,
        'class'         => $dt_class,
        'formatter'     => $dt_formatter,
    ],
    ```

    Which is:

    - `$dt_col_header` is the header of the column (at the table in views/blade), for example:

    ```
    $dt_col_header = 'Username';
    ```

    - `$db_col_name` is column name based on the DB, for example:

    ```
    $db_col_name = 'uname';
    ```

    - `$dt_class` is a class/classes name which will be added to the table (in views/blade), for example:

    ```
    $dt_class = 'text-center';

    // or use array for multiple classes

    $dt_class = ['text-center', 'text-bold'];
    ```

    - `$dt_formatter` is like a modifier that can modify the data from DB to be shown in views/blade, for example:

    ```
    $dt_formatter = function ($value, $model) {
        return ucwords($value);
        // which is 'value' is the value of the column

        // or
        return $model->name;
        // which is 'model' is the model of the current row

        // or
        return $value . '(#' .$model->id. ')';
    };
    ```

Example
-------

[](#example)

### In PHP (Controller)

[](#in-php-controller)

```
namespace App\Http\Controllers\AdminPanel;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use SoulDoit\DataTable\SSP;

class UsersController extends Controller
{
    private $ssp;

    public function __construct()
    {
        $ssp = new SSP();

        $ssp->enableSearch();
        $ssp->allowExportAllItemsInCsv();
        $ssp->setAllowedItemsPerPage([5, 10, 20, -1]);
        $ssp->frontend()->setFramework('datatablejs');

        $ssp->setColumns([
            ['label'=>'ID',         'db'=>'id',            'formatter' => function ($value, $model) {
                return str_pad($value, 5, '0', STR_PAD_LEFT);
            }],
            ['label'=>'Email',      'db'=>'email',         ],
            ['label'=>'Username',   'db'=>'uname',         ],
            ['label'=>'Created At', 'db'=>'created_at',    ],
            ['label'=>'Action',     'db'=>'id',            'formatter' => function ($value, $model) {
                $btns = [
                    'Edit',
                    'Delete',
                ];
                return implode($btns, " ");
            }],
            ['db'=>'email_verified_at'],
        ]);

        $ssp->setQuery(function ($selected_columns) {
            return \App\Models\User::select($selected_columns)
            ->where('status', 'active')
            ->where(function ($query) {
                $query->where('id', '!=', 1);
                $query->orWhere('uname', '!=', 'superadmin');
            });
        });

        $this->ssp = $ssp;
    }

    public function page()
    {
        return view('admin-panel.users-list', [
            'fe_settings' => $this->ssp->frontend()
                ->setInitialSorting('created_at', true) // this means `order created_at desc`
                ->setInitialItemsPerPage(10)
                ->setResponseDataUrl(route('users.get'))
                ->getSettings(true),
        ]);
    }

    public function get()
    {
        return $this->ssp->response()->json();
    }
}
```

### In Blade (Views)

[](#in-blade-views)

```

        Laravel DataTable SSP

        $(document).ready(function(){
            $('#datatable_1').DataTable({!! $fe_settings !!});
        });

        function edit (id) {
            alert(`edit for user with id ${id}`);
        }

        function delete (id) {
            alert(`delete user with id ${id}`);
        }

```

Support me
----------

[](#support-me)

If you find this package helps you, kindly support me by donating some BNB (BSC) to the address below.

```
0x364d8eA5E7a4ce97e89f7b2cb7198d6d5DFe0aCe

```

[![](https://camo.githubusercontent.com/67c5326d8855725c2e2fe63a03bbb2dbd6efed10e1fda2c02c20af0a041a2a72/68747470733a2f2f696e666f2e736f756c646f69742e636f6d2f696d672f77616c6c65742d616464726573732d626e622d6273632e706e67)](https://camo.githubusercontent.com/67c5326d8855725c2e2fe63a03bbb2dbd6efed10e1fda2c02c20af0a041a2a72/68747470733a2f2f696e666f2e736f756c646f69742e636f6d2f696d672f77616c6c65742d616464726573732d626e622d6273632e706e67)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance86

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 96.2% 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 ~32 days

Recently: every ~144 days

Total

80

Last Release

74d ago

Major Versions

1.4.1 → 2.0.02019-05-03

2.3.12 → 3.0.02023-10-13

PHP version history (4 changes)1.0PHP &gt;=5.5.0

1.1.1PHP &gt;=7.1.0

3.0.0PHP &gt;=8.2.0

3.2.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/605123f58f21c062a28a90d9db68fc30a26bc4b4016b35cb9787ae4e0c847a40?d=identicon)[syamsoul](/maintainers/syamsoul)

---

Top Contributors

[![syamsoul](https://avatars.githubusercontent.com/u/15118790?v=4)](https://github.com/syamsoul "syamsoul (51 commits)")[![includeVitor](https://avatars.githubusercontent.com/u/38621315?v=4)](https://github.com/includeVitor "includeVitor (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")

---

Tags

phplaraveldatatablesouldoitsyamsoulsspserver-side

### Embed Badge

![Health badge](/badges/syamsoul-laravel-datatable-ssp/health.svg)

```
[![Health](https://phpackages.com/badges/syamsoul-laravel-datatable-ssp/health.svg)](https://phpackages.com/packages/syamsoul-laravel-datatable-ssp)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)

PHPackages © 2026

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