PHP code example of sorexalpinus / cubify

1. Go to this page and download the library: Download sorexalpinus/cubify 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/ */

    

sorexalpinus / cubify example snippets


$cube = new MysqlCube(
    //sql connection
    new mysqli('localhost','root','','wildlife_test',3308),
    //base query
    'SELECT * FROM spotted_animals',
    //masks
    ['111', '110', '101'],
    //dimensions
    ['Transect', 'Year', 'Species'],
    //measures & aggregate functions
     ['Snow depth' => 'AVG', 'Num animals' => 'SUM']
);
$data = $cube->getResultDataset();
print_r($data);