The topic uses PHP-ML for all machine learning algorithms. The installation of the library can be done using
composer require php-ai/php-ml
The github repository for the same can be found here.
Also it is worth noting that the examples given are very small data-set only for the purpose of demonstration. The actual data-set should be more comprehensive than that.