1. Go to this page and download the library: Download xtompie/flow 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/ */
use Xtompie\Flow\Flow;
use Xtompie\Flow\FlowFilter;
use Xtompie\Flow\FlowGet;
use Xtompie\Flow\FlowMap;
use Xtompie\Flow\FLowSort;
class Animals
{
use Flow;
use FlowFilter;
use FlowGet;
use FlowMap;
use FLowSort;
public function alfabetic()
{
return $this->sort();
}
public function pets()
{
$pets = ['cat', 'dog', 'rat'];
return $this->filter(function($animal) use ($pets) {
return in_array($animal, $pets);
});
}
public function pretty()
{
return $this->map(function($animal) {
return ucfirst($animal);
});
}
}
$animals = (new Animals(['rat', 'cat', 'lion', 'puma', 'dog']))
->alfabetic()
->pets()
->pretty()
;
print_r($animals->get());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.