PHP code example of ricardopedias / freep-console

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

    

ricardopedias / freep-console example snippets


class MyCommand extends Command
{
    protected function initialize(): void
    {
        $this->setName("my-command");
        $this->addOption(
            new Option('-r', '--read', 'Read a text file', Option::REQUIRED)
        );
    }

    protected function handle(Arguments $arguments): void
    {
        $this->info("Hello");
    }
}

#!/bin/php

gv);

$terminal = new Freep\Console\Terminal("/root/of/super/application");
$terminal->loadCommandsFrom("/directory/of/commands");
$terminal->run($argv);