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

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

zulyantara/codeigniter4-datatables
==================================

Serverside Datatables library for CodeIgniter4

00PHP

Since Nov 2Pushed 2y agoCompare

[ Source](https://github.com/zulyantara/CodeIgniter4-DataTables)[ Packagist](https://packagist.org/packages/zulyantara/codeigniter4-datatables)[ RSS](/packages/zulyantara-codeigniter4-datatables/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CodeIgniter4 DataTables Library
===============================

[](#codeigniter4-datatables-library)

[![Donate](https://camo.githubusercontent.com/d47cdb766a100070d38a702d9c7760ccc8052063484e1478a26bcd16680d33af/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d626c75652e737667)](https://www.paypal.me/mbahcoding)[![Total Downloads](https://camo.githubusercontent.com/fd6442425825f5024b461c7cd0516693a70b8ead92b3ff3de6fb05cad54e6c55/68747470733a2f2f706f7365722e707567782e6f72672f6865726d6177616e2f636f646569676e69746572342d646174617461626c65732f646f776e6c6f616473)](https://packagist.org/packages/hermawan/codeigniter4-datatables)[![GitHub repo size](https://camo.githubusercontent.com/c78afcf20684984bd5a8250decd23a310a7b918d77fa1847fb3352661be3f8d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6865726d6177616e72616d616468616e2f436f646549676e69746572342d446174615461626c65733f6c6162656c3d73697a65)](https://camo.githubusercontent.com/c78afcf20684984bd5a8250decd23a310a7b918d77fa1847fb3352661be3f8d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6865726d6177616e72616d616468616e2f436f646549676e69746572342d446174615461626c65733f6c6162656c3d73697a65)[![GitHub](https://camo.githubusercontent.com/5c1390657465ba9ec6f17e7b28e68855f3ace74b3d89196d43c01f74e7b81e7c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6865726d6177616e72616d616468616e2f436f646549676e69746572342d446174615461626c6573)](https://camo.githubusercontent.com/5c1390657465ba9ec6f17e7b28e68855f3ace74b3d89196d43c01f74e7b81e7c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6865726d6177616e72616d616468616e2f436f646549676e69746572342d446174615461626c6573)

Server-side Datatables library for CodeIgniter4 PHP framework CodeIgniter4-DataTables is CodeIgniter4 Library to handle server-side processing of DataTables jQuery Plugin via AJAX option by using Query Builder CodeIgniter 4

Documentation
=============

[](#documentation)

For more complete example and demo please visit [Documentation here](https://codeigniter4-datatables.hermawan.dev/welcome)

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

[](#requirements)

- Codeigniter 4.x
- jQuery DataTables v1.10.x

Installing
----------

[](#installing)

### Using composer (recommended)

[](#using-composer-recommended)

Use composer to install CodeIgniter4-DataTables into your project :

> composer require hermawan/codeigniter4-datatables

### Manual installation

[](#manual-installation)

Or If you prefer not to use Composer to install, you can install manually. Download this from git repository. Extract and rename folder to `codeigniter4-datatables` in example place this on `ThirdParty` folder.

also this library need download dependency:

- this library require `php-sql-parser`. download here  Extract and rename also to `php-sql-parser`. Then open `app/Config/Autoload.php` and add namespace to the `$psr4` array.

```
$psr4 = [
     APP_NAMESPACE => APPPATH, // For custom app namespace
     'Config'      => APPPATH . 'Config',
     'PHPSQLParser'          => APPPATH .'ThirdParty/php-sql-parser/src/PHPSQLParser', //  APPPATH .'ThirdParty/codeigniter4-datatables/src', // table('customers')->select('customerNumber, customerName, phone, city, country, postalCode');

    return DataTable::of($builder)->toJson();
}
```

### Using CodeIgniter Model

[](#using-codeigniter-model)

You can initialize using `Model` instead `Query Builder`This is simple example basic code

**Controller :**

```
use \Hermawan\DataTables\DataTable;
use \App\Models\CustomerModel;

public function ajaxDatatable()
{
    $customerModel = new CustomerModel();
    $customerModel->select('customerNumber, customerName, phone, city, country, postalCode');

    return DataTable::of($customerModel)->toJson();
}
```

**Javascript :**

```
$(document).ready(function() {
    $('#table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '
