2017 © Pedro Peláez
 

library console

Simple PHP Console

image

jnjxp/console

Simple PHP Console

  • Thursday, May 25, 2017
  • by jnj
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

jnjxp.console

Really simple commandline interface, (*1)

Usage

Console

/**
 * Some Commands
 */

class HelloWorld
{
    public function __invoke($name = 'World')
    {
        echo "Hello $name" . PHP_EOL;
        return \Jnjxp\Console\Status::SUCCESS;
    }
}

class ByeWorld
{
    public function __invoke($name = 'World')
    {
        echo "Bye $name" . PHP_EOL;
        return \Jnjxp\Console\Status::SUCCESS;
    }
}


/**
 * Create an application
 */
$console = new Jnjxp\Console\Console(
    [
        'hi'  => HelloWorld::class,
        'bye' => ByeWorld::class
    ]
);


// Execute based on input and exit
$status = $console($argv);
exit($status);

StdLog

See: http://paul-m-jones.com/archives/6552, (*2)

$log = new \Jnjxp\Console\StdLog;
$log->setLevel(\Psr\Log\LogLevel::INFO);

$log->debug('This wont print cuz level');
$log->info('Prints to stdout');
$log->error('Prints to STDERR');

The Versions

25/05 2017

dev-develop

dev-develop

Simple PHP Console

  Sources   Download

MIT

The Requires

 

by jake johns