1. Go to this page and download the library: Download bellows/pvc 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/ */
# Branched batches
$pipeline = new \Pvc\Pipeline;
$pipeline
->branch('switch', function($datum) {
return $datum['type'];
})
// the second argument is always the path this data took
->collect(30, function($data, $path) {
echo "For type ".$path['switch'].": ".count($data)." records\n";
});
$type = 0;
for ($i = 0; $i < 100; $i++) {
$pipeline->push(['type' => ($type++) % 3, 'id' => $i ]);
};
$pipeline->flush();
// For type 0: 30
// For type 1: 30
// For type 2: 30
// For type 0: 4
// For type 1: 3
// For type 2: 3
$pipeline = new \Pvc\Pipeline;
$pipeline->transform(function($data) use (&$lookupTable) {
return $lookupTable[$data->getId()];
});
$pipeline = new \Pvc\Pipeline;
$pipeline->filter(function($data) use (&$lookupTable) {
return $data instanceof GoodData;
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.