A quick google search brought me to PHP-ML, a lib which you just install with composer and then use it like this:
require_once __DIR__ . '/vendor/autoload.php';
use Phpml\Classification\KNearestNeighbors;
$samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]];
$labels = ['a', 'a', 'a', 'b', 'b', 'b'];
$classifier = new KNearestNeighbors();
$classifier->train($samples, $labels);
$classifier->predict([3, 2]);
// return 'b'
So you could easily use that in a laravel project. But since it's the first result of a google search, you probably already found it and it doesn't suit your needs...