1. Go to this page and download the library: Download mapsight/pulp 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/ */
mapsight / pulp example snippets
use OpenMapsight\Pulp;
use OpenMapsight\pulp\File;
Pulp::start()
->pipe(Pulp::src('.*\.txt', __DIR__ . '/input'))
->pipe(Pulp::map(static function (File $file): File {
$file->content = strtoupper($file->content);
return $file;
}))
->pipe(Pulp::dest(__DIR__ . '/output'))
->run();
->pipe(Pulp::map(static function (File $file): File {
$stream = $file->stream();
try {
while (($line = fgets($stream)) !== false) {
// Process without loading the full file.
}
} finally {
fclose($stream);
}
return $file;
}))
use OpenMapsight\pulp\AbstractHandler;
use OpenMapsight\pulp\File;
class UppercaseHandler extends AbstractHandler
{
public function onFile(File $file): void
{
$file->content = strtoupper($file->content);
$this->pushFile($file);
}
}
class PrefixHandler extends AbstractHandler
{
protected function getConstructorParamDefs(): array
{
return ['prefix'];
}
public function onFile(File $file): void
{
$file->content = $this->cp->prefix . $file->content;
$this->pushFile($file);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.