PHP code example of quebecstudio-mods / consent-kit-register

1. Go to this page and download the library: Download quebecstudio-mods/consent-kit-register 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/ */

    

quebecstudio-mods / consent-kit-register example snippets


use QuebecStudioMods\ConsentKit\Register\Connection;
use QuebecStudioMods\ConsentKit\Register\Register;

$register = new Register(new Connection());

$register->store([
    'siteHandle' => 'default',
    'userId' => null,
    'language' => 'en',
    'decidedAt' => '2026-09-23 14:02:11',
    'action' => 'save',
    'origin' => 'dialog',
    'categories' => ['necessary', 'analytics'],
    'outcome' => 'partial',
    'consentVersion' => 3,
    'presentationId' => $register->presentationId($presentation),
]);

['rows' => $rows, 'total' => $total] = $register->page(['site' => 'default'], page: 1, perPage: 50);

$rows = $register->rows($register->query()->where('d.outcome', 'all'), 1, 50, 'decidedAt', 'desc');