esclaudio / datatables
Simple server side processing for datatables
1.1.0
2022-01-22 19:51 UTC
Requires
- php: ^7.2 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: dev-master
- mockery/mockery: 1.3.x-dev
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-05-23 00:45:37 UTC
README
Installation
You can install the package via composer:
composer require esclaudio/datatables
Usage
use Esclaudio\Datatables\Datatables; use Esclaudio\Datatables\Options; use Esclaudio\Datatables\Database\Connection; $connection = new Connection(new \PDO(...)); $options = new Options($_GET); header('Content-Type: application/json'); echo (new Datatables($connection, $options)) ->from('posts') ->join('users', 'users.id', '=', 'posts.created_by') ->select([ 'posts.id as id', 'posts.title as title', 'users.name as creator', ]) ->toJson(); // {"draw": 1, "recordsTotal": 1, "recordsFiltered": 1, "data": {...}}
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.