2017 © Pedro PelĂĄez
 

library cli

Simple and silly abstraction on top of symfony/console

image

crodas/cli

Simple and silly abstraction on top of symfony/console

  • Friday, May 5, 2017
  • by crodas
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,896 Installations
  • PHP
  • 10 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

cli

Simple and silly abstraction on top of symfony/console, (*1)

How does it work?

The main goal is to give a generic and extensible way of registering console applications., (*2)

The application itself should like like this (cli.php)., (*3)

<?php
require __DIR__ . '/vendor/autoload.php';

$cli = new crodas\cli\Cli("/tmp/some.cache.tmp");
// the vendors cli
$cli->addDirectory(__DIR__ . '/vendor');
// add my APP directory
$cli->addDirectory(__DIR__ . '/apps');

// run
$cli->main();

Then inside apps/ we could have apps/cli/foobar.php and it should look like this:, (*4)

<?php
namespace myApp\Cli;

/**
 * @Cli("foobar", "some text to describe my app")
 * @Arg('name', OPTIONAL, 'add name')
 * @Option('foobar', VALUE_REQUIRED|VALUE_IS_ARRAY, 'add name')
 */
function foobar_main($input, $output)
{
    $arg = $input->getArgument('name');
    $opt = $input->getOption('foobar');
    $output->writeLn(json_encode(compact('arg', 'opt')));
}

Now we can easily do php cli.php foobar, foobar_main function would be called., (*5)

Benefits

  1. Console applications are discovered
    • No autoloader needed
    • No conventions to follow
  2. It can use some cache function to avoid scanning lots of directories and files everytime.
  3. Annotations :-)
  4. Plugins support
    1. @One or @Crontab make sure your command runs just once

The Versions

05/05 2017

dev-develop

dev-develop

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

The Development Requires

by CĂ©sar D. Rodas

16/11 2016

dev-master

9999999-dev

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

16/11 2016

v0.1.9

0.1.9.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

11/03 2016

v0.1.8

0.1.8.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

30/08 2015

v0.1.7

0.1.7.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

23/06 2015

v0.1.6

0.1.6.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

23/06 2015

v0.1.5

0.1.5.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

15/06 2015

v0.1.4

0.1.4.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

03/05 2015

v0.1.3

0.1.3.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

26/01 2015

v0.1.2

0.1.2.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

30/12 2013

v0.1.1

0.1.1.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas

16/11 2013

v0.1.0

0.1.0.0

Simple and silly abstraction on top of symfony/console

  Sources   Download

BSD-4-Clause

The Requires

 

by CĂ©sar D. Rodas