Skip to content

New versions of the zend framework 2 console helper family available now

I happy to announce the release of 1.1.0 of bazzlines zend framework 2 console helper (debian backport) module for php as well as the release of 1.1.0 of bazzlines zend framework 2 console helpermodule for php.
Important changes are:

  • added AbstractConsoleControllerFactory
Translate to de es fr it pt ja

version 1.0.2 of zend framework 2 console helper (debian 6 backport) released

I happy to announce the release of 1.0.2 of bazzlines zend framework 2 console helper (debian backport) module for php. Important changes are:

  • removed dependency to apigen
  • updated dependencies
Translate to de es fr it pt ja

version 1.0.3 of zend framework 2 console helper released

I happy to announce the release of 1.0.3 of bazzlines zend framework 2 console helper module for php. Important changes are:

  • removed apigen dependency
  • added use statement into example
  • added link to demo environment
  • added link to debian 6 / zend framework 2.2 backport
  • added minimum version of zend framework 2 to 2.3.* since AbstractConsoleController is mandatory
  • updated dependencies
Translate to de es fr it pt ja

version 1.0.0 of zend framework 2 console helper (debian 6 backport) released

I am happy to announce the release of 1.0.0 of bazzlines zend framework 2 console helper module for php.
It is a backport of the existing locator generator module.

Translate to de es fr it pt ja

version 1.0.1 of zend framework 2 console helper released

I happy to announce the release of 1.0.1 of bazzlines zend framework 2 console helper module for php. Important changes are:

  • added example code output
  • added apigen
  • moved to usage of "Zend\Mvc\Controller\AbstractConsoleController"
Translate to de es fr it pt ja

version 1.0.0 of zend framework 2 console helper released

I happy to announce the release of 1.0.0 of bazzlines zend framework 2 console helper module for php.
This module should easy up implementing console commands supporting POSIX Signal Handling.
Furthermore, there are some simple but useful methods implemented:

  • getConsole()
  • getParameter($name)
  • getRequest()
  • hasBooleanParameter($shortName = '', $longName = '')
  • hasParameter($name)
  • throwExceptionIfNotCalledInsideAnCliEnvironment()

How can I use it?


namespace MyModule\Controller\Console;

use Exception;

class IndexController extends AbstractConsoleController { public function indexAction() { try { $this->throwExceptionIfNotCalledInsideAnCliEnvironment();

        $this->attachSignalHandler($this);

        //some example items
        //  simple think about a lot of items that indicates longer
        //  processing runtime
        $items = array('one', 'two', 'three', 'four');

        //use implemented method to react on signal handling
        $this->processItems(
            $items,             //big list of items
            $this,              //current object
            'processItem',      //method that should be called for each item
            $arguments = array( //additional arguments for method 'processItem' (if needed)
                'foo',
                'bar'
            )
        );
    } catch (Exception $exception) {
        $this->handleException($exception);
    }
}

/**
 * must be protected since it will be called from the parent
 *
 * @param string $item
 * @param string $stringOne
 * @param string $stringTwo
 */
protected function processItem($item, $stringOne, $stringTwo)
{
    $console = $this->getConsole();
    $console->writeLine(
        'this is item "' . $item .
        '" with string one "' . $stringOne . '"' .
        '" and string two "' . $stringTwo . '"'
    );
}

/**
 * @return boolean
 */
private function beVerbose()
{
    return $this->hasBooleanParameter('v', 'verbose');
}

}

How can I install it?

with packagist


composer require netbazzline/zfconsolehelper:dev-master

manuel


mkdir -p vendor/netbazzline/zfconsolehelper
cd vendor/netbazzline/zfconsolehelper
git clone https://github.com/zfconsole_helper
Translate to de es fr it pt ja