PHP code example of chubbyphp / chubbyphp-lazy-command

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

    

chubbyphp / chubbyphp-lazy-command example snippets




use Chubbyphp\Lazy\LazyCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

$container['service'] = function () {
    return function (InputInterface $input, OutputInterface $output) {
        // run some lazy logic
    };
};

$command = new LazyCommand(
   $container,
   'service',
   'name',
   [
       new InputArgument('argument'),
   ],
   'description',
   'help'
);

$command->run();



use Chubbyphp\Lazy\CommandAdapter;
use Chubbyphp\Lazy\LazyCommand;
use Symfony\Component\Console\Input\InputArgument;

$container['service'] = function () {
    return new CommandAdapter(new ExistingCommand());
};

$command = new LazyCommand(
   $container,
   'service',
   'name',
   [
       new InputArgument('argument'),
   ],
   'description',
   'help'
);

$command->run();