PHP code example of blumilksoftware / heatmap

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

    

blumilksoftware / heatmap example snippets


$data = [
    ["created_at" => "2022-11-01 00:00:00", /** (...) */],
    ["created_at" => "2022-11-03 00:00:00", /** (...) */],
    ["created_at" => "2022-11-16 00:00:00", /** (...) */],
    ["created_at" => "2022-11-16 00:00:00", /** (...) */],
    ["created_at" => "2022-11-18 00:00:00", /** (...) */],
    ["created_at" => "2022-11-19 00:00:00", /** (...) */],
];

$builder = new HeatmapBuilder();
$result = $builder->build($data);
json
[
  {
    "label": "2022-11-16",
    "count": 2,
    "description": ""
  },
  {
    "label": "2022-11-17",
    "count": 0,
    "description": ""
  },
  {
    "label": "2022-11-18",
    "count": 1,
    "description": ""
  },
  {
    "label": "2022-11-19",
    "count": 1,
    "description": ""
  },
  {
    "label": "2022-11-20",
    "count": 0,
    "description": ""
  },
  {
    "label": "2022-11-21",
    "count": 0,
    "description": ""
  },
  {
    "label": "2022-11-22",
    "count": 0,
    "description": ""
  },
  {
    "label": "2022-11-23",
    "count": 0,
    "description": ""
  }
]