PHP code example of centralapps / common-console-commands

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

    

centralapps / common-console-commands example snippets


#!/usr/bin/env php


pheanstalk' => PHEANSTALK_GOES_HERE
);

$cli_application = new \Symfony\Component\Console\Application();

$commands = array(
    '\CentralApps\Commands\PheanstalkStatsCommand',
    '\CentralApps\Commands\PheanstalkListCommand',
    '\CentralApps\Commands\PheanstalkPeekReadyCommand',
    '\CentralApps\Commands\PheanstalkDeleteCommand',
    '\CentralApps\Commands\PheanstalkFlushCommand'
);

foreach ($commands as $command) {
    $command = new $command();

    if ($command instanceof \CentralApps\Commands\AcceptsContainerInterface) {
        $command->setContainer($container);
    }

    $cli_application->add($command);
}

$cli_application->run();