2017 © Pedro Peláez
 

library trieur

image

polinome/trieur

  • Tuesday, June 26, 2018
  • by Polinome
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

README

TRIEUR

Trieur is a php library to sort, filter data with differents * data source (database, csv file...) managed by the Source classes * query format (array like $_POST...) managed by the Driver classes * output format (array, csv formated string...) managed by the Driver classes, (*1)

The main classes is a Dependency Injection Container (it extends the famous Pimple). It instanciates a driver class, a source class and a columns configuration class. Each source and driver class each extend an abstract containing basic methods to communicate through the main class., (*2)

It was originally build to print data in ower backend solution to display data, and to export them. We use dataTables jquery pluggin. Therefore one of the driver available is made for this javascript pluggin., (*3)

USAGE

use Polinome\Trieur\Trieur;
use Solire\Conf\Conf;
use Doctrine\DBAL\DriverManager;

// Defining the trieur configuration
$trieurConf = new Conf;
$trieurConf
    ->set('csv', 'driver', 'name')
    ...
    ->set('doctrine', 'source', 'name')
    ...
;

// Defining a source, here we use a doctrine connection
$parameters = [
    'driver' => 'pdo_mysql',
    ...
];
$doctrineConnection = DriverManager::getConnection($parameters);

// Then here goes the magic
$trieur = new Trieur($conf, $doctrineConnection);
$trieur->setRequest($_POST);

$response = $trieur->getResponse();

header('Content-type: application/json');
echo json_encode($response);

The Versions