rougin/datatables

PHP wrapper for Datatables' server-side.

dev-master / 1.0.x-dev 2020-10-06 01:26 UTC

This package is auto-updated.

Last update: 2024-11-06 10:28:19 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Datatables is a package that uses Doctrine or Eloquent to generate a server-side AJAX result to a Datatable instance with little to no configuration.

Installation

Install Datatables via Composer:

$ composer require rougin/datatables

Basic Usage

Doctrine

use Rougin\Datatables\DoctrineBuilder;

$entity = 'Acme\Doctrine\Models\User';

$builder = new DoctrineBuilder($manager, $entity, $_GET);

header('Content-Type: application/json');

echo json_encode($builder->make());

NOTE: $manager must return an instance of Doctrine\ORM\EntityManager. See DoctrineBuilderTest::setUp for the sample implementation.

Eloquent

use Rougin\Datatables\EloquentBuilder;

$model = 'Acme\Eloquent\Models\UserModel';

$builder = new EloquentBuilder($model, $_GET);

header('Content-Type: application/json');

echo json_encode($builder->make());

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Credits

License

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