1. Go to this page and download the library: Download marvin255/fluent-iterable 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/ */
marvin255 / fluent-iterable example snippets
use Marvin255\FluentIterable\FluentIterable;
use Marvin255\FluentIterable\Helper\Reducer;
use Marvin255\FluentIterable\Helper\Filter;
use Marvin255\FluentIterable\Helper\Compare;
$input = [1, 2, 3, 4];
$result = FluentIterable::of($input)
->skip(1)
->filter(Filter::compare(Compare::LESS_THEN, 4))
->map(fn (int $item): int => $item + 1)
->reduce(Reducer::sum())
->get();