Super simple PHP library for getting the median of array values (can also calc the average of the array's elements).
composer install mazedlx/median
$arrayOfValues = [1, 2, 5, 1000, 7]
$m = new Median($arrayOfValues);
$avg = $m->average();
// $avg == 203
$median = $m->median();
// $median == 5