/**
  * @return CursorPaginationBuilder
  */
 private function getCursorPagination()
 {
     $paginationBuilder = new CursorPaginationBuilder();
     $paginationBuilder->registerPropertyName('id', 'public_id');
     $paginationBuilder->registerPropertyName('name', 'public_name');
     $paginationBuilder->registerPropertyName('score', 'public_score');
     return $paginationBuilder;
 }
<?php

use CatLab\Base\Models\Database\OrderParameter;
use CatLab\CursorPagination\CursorPaginationBuilder;
require '../vendor/autoload.php';
require 'helpers.php';
$pdo = (require 'mockdata.php');
$builder = new CursorPaginationBuilder();
// Show 5 records on each page
$builder->limit(isset($_GET['records']) ? $_GET['records'] : 5);
// Register properties
$builder->registerPropertyName('id', 'public_id');
$builder->registerPropertyName('name', 'public_name');
$builder->registerPropertyName('score', 'public_score');
/**
 * Set select order
 */
// Order by score desc
$builder->orderBy(new OrderParameter('score', OrderParameter::DESC));
// Same score? Order by name asc
$builder->orderBy(new OrderParameter('name', OrderParameter::ASC));
// Same score and same name? Sort on ID
$builder->orderBy(new OrderParameter('id', OrderParameter::ASC));
// Set the request parameters
$builder->setRequest($_GET);
/**
 * Select and output data
 */
// Build the select query
$query = $builder->build();
// Load the data