PHP code example of polinome / trieur

1. Go to this page and download the library: Download polinome/trieur library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

polinome / trieur example snippets


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);