1. Go to this page and download the library: Download crwgregory/php-kmeans 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/ */
// create a 2 dimentionnal space and fill it
$space = new KMeans\Space(2);
foreach ($points as $point)
$space->addPoint($point);
// resolve 3 clusters
$clusters = $space->solve(3);