PHP code example of innmind / cli

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

    

innmind / cli example snippets


# cli.php

declare(strict_types = 1);

t,
};
use Innmind\OperatingSystem\OperatingSystem;

new class extends Main {
    protected function main(Environment $env, OperatingSystem $os): Environment
    {
        //your code here
        return $env;
    }
};

use Innmind\CLI\{
    Commands,
    Command,
    Command\Arguments,
    Command\Options,
    Console,
};

function main(Environment $env, OperatingSystem $os): void
{
    $run = Commands::of(
        new class implements Command {
            public function __invoke(Console $console): Console
            {
                //your code here
            }

            public function usage(): string
            {
                return 'foo';
            }
        }
    );

    return $run($env);
};