PHPackages                             sp-datatables/sp-datatables - 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. sp-datatables/sp-datatables

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

sp-datatables/sp-datatables
===========================

A simple jquery datatable editor library in PHP

v1.6.1(2y ago)08211MITPHPPHP &gt;=5.3.0

Since Nov 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Gicehajunior/SPDataTable)[ Packagist](https://packagist.org/packages/sp-datatables/sp-datatables)[ Docs](https://github.com/Gicehajunior/SPDataTable.git)[ RSS](/packages/sp-datatables-sp-datatables/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (9)Used By (1)

SPDataTable
===========

[](#spdatatable)

SPDataTable is a simple jQuery datatable editor library in PHP that allows you to manipulate and generate data tables effortlessly. It has a simple and easy to use API that allows you to add, edit, remove and generate data tables from a query result or an array of data. It supports SelfPhP, CodeIgnitor, Cake PHP, Laravel and other PHP frameworks as well as procedural PHP. Below is the walkthrough of how to use SPDataTable.

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

[](#installation)

You can install SPDataTable by downloading the class SP\\Datatables\\SPDataTable.php and including it in your project. You can also install it using Composer as shown below:

```
composer require sp-datatables/sp-datatables
```

Usage
=====

[](#usage)

Basic Usage
-----------

[](#basic-usage)

```
require __DIR__ . "/SPDataTable.php";

// Create an instance of SPDataTable
$dataTable = new SPDataTable();

// Add data rows
$dataTable->addRow(['name' => 'John', 'age' => 25, 'city' => 'New York']);
$dataTable->addRow(['name' => 'Jane', 'age' => 30, 'city' => 'London']);

// Edit a column
$dataTable->editColumn('age', function($value) {
    return $value * 2;
});
```

To generate the columns and data, call the `make()` method.

```
// Generate columns and data
$result = $dataTable->make();
```

```
// Output the result
print_r($result);
```

Advanced Usage
--------------

[](#advanced-usage)

```
require_once 'vendor/autoload.php';

use SP\DataTables\SPDataTable;

// Create an instance of SPDataTable
$dataTable = new SPDataTable();

// Set table data from a query result
$queryResult = [
    ['id' => 1, 'name' => 'John', 'age' => 25, 'city' => 'New York'],
    ['id' => 2, 'name' => 'Jane', 'age' => 30, 'city' => 'London'],
    // ... more data
];

$dataTable->setTableData($queryResult)
    ->editColumn('age', function($value) {
        return $value * 2;
    })
    ->removeRow(1)
    ->removeColumn('id')
    ->setCustomContent('custom', function($row) {
        return $row['name'] . ' lives in ' . $row['city'];
    });
```

```
// Generate columns and data
$result = $dataTable->make();
```

```
// Output the result
print_r($result);
```

### Output Example

[](#output-example)

The output will be in JSON format.

```
{
    [
        {
            "name": "John",
            "age": 50,
            "city": "New York",
            "custom": "John lives in New York"
        },
        {
            "name": "Jane",
            "age": 60,
            "city": "London",
            "custom": "Jane lives in London"
        }
    ]
}
```

Documentation
-------------

[](#documentation)

For more information, please raise an issue or contact me at [Giceha Junior](mailto:gicehajunior76@gmail.com)

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

License
-------

[](#license)

License, [MIT](https://github.com/Gicehajunior/SPDataTable/blob/main/LICENSE)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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

917d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a48ce1bb37d54415fa911f2aeaec5a5450e2df2e8eaaa7baba68b8945bbe9a12?d=identicon)[gicehajunior](/maintainers/gicehajunior)

---

Top Contributors

[![Gicehajunior](https://avatars.githubusercontent.com/u/49983428?v=4)](https://github.com/Gicehajunior "Gicehajunior (12 commits)")

---

Tags

phpjqueryeditordatatable

### Embed Badge

![Health badge](/badges/sp-datatables-sp-datatables/health.svg)

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

###  Alternatives

[froala/wysiwyg-editor

A beautiful jQuery WYSIWYG HTML rich text editor. High performance and modern design make it easy to use for developers and loved by users.

5.4k306.9k3](/packages/froala-wysiwyg-editor)[yajra/laravel-datatables-editor

Laravel DataTables Editor plugin for Laravel 5.5+.

1186.1M2](/packages/yajra-laravel-datatables-editor)[nullref/yii2-datatables

Yii2 Extension for DataTables jQuery plug-in

7290.3k](/packages/nullref-yii2-datatables)

PHPackages © 2026

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