PHP code example of zero-config / cli

1. Go to this page and download the library: Download zero-config/cli 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/ */

    

zero-config / cli example snippets



use ZeroConfig\Cli\Reader\StandardIn;

$pipe = new StandardIn();

// Echo what is piped to the application.
foreach ($pipe as $line) {
    echo $line;
}


use ZeroConfig\Cli\Writer\File;
use ZeroConfig\Cli\Reader\ReaderInterface;

$writer = new File('The.Zookeeper\'s.Wife.mp4');

/** @var ReaderInterface $movie */
$writer($movie);


use ZeroConfig\Cli\Transformer\Pcre\MatchFilter;

$transformer = new MatchFilter('/[Bb]a[rz]/');
$input       = [
    'This is foo!',
    'Greetings from bar :)',
    'A wonderful day from baz.'
];

foreach ($transformer($input) as $line) {
    echo $line . PHP_EOL;
}