PHP code example of rikby / symfony-command-collector

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

    

rikby / symfony-command-collector example snippets


#!/usr/bin/env php

onsole\Application as App;
use Rikby\SymfonyConsole\CommandCollector\Collector;

$app = new App('Super shell console.', '0.1.0');
$app->add(new SubOneCommand());
$app->add(new SubTwoCommand());

//collect other commands
$collector = new Collector();
$collector->setPaths([__DIR__.'/../vendor/*/*/bin'])
    ->setName('super')
    ->setCompiledFile(__DIR__.'/.build-super.php')
    ->captureCommands();

// here .build-super.php must be generated even it's empty


/** @var $app Symfony\Component\Console\Application */
$app->add(new My\PackOne\FooCommand());


/** @var $app Symfony\Component\Console\Application */
$app->add(new My\PackTwo\BarCommand());


/** @var $app Symfony\Component\Console\Application */
$app->add(new My\PackOne\FooCommand());
/** @var $app Symfony\Component\Console\Application */
$app->add(new My\PackTwo\BarCommand());

bin/
    .autoload-init.php
    super
src/
    SubOneCommand.php
    SubTwoCommand.php
vendor/
    my-vendor/
        pack111/
            bin/super-app-