2017 © Pedro Peláez
 

library console-config-resolver

Simply create a symfony console application instance via zend-servicemanager.

image

dwendrich/console-config-resolver

Simply create a symfony console application instance via zend-servicemanager.

  • Thursday, May 18, 2017
  • by dwendrich
  • Repository
  • 0 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

console-config-resolver

Simply create a symfony console application instance via zend-servicemanager., (*1)

Build Status Coverage Status Latest Stable Version, (*2)

Requirements

Installation

ConsoleConfigResolver can be installed with composer. For information on how to get composer or how to use it, please refer to getcomposer.org., (*3)

Installation via command line:, (*4)

$ php composer.phar require dwendrich/console-config-resolver

Installation via composer.json file:, (*5)

{
    "require": {
        "dwendrich/console-config-resolver": "*"
    }
}

Usage

As part of the service-manager configuration you provide a section for the console application, e. g., (*6)

return [
    'Example\Console' => [
        'name'     => 'My console application',
        'version'  => '1.0.0',
        'commands' => [
            // provide a class name or a service name configured in service manager
            MyConsoleCommand::class,

            // instances have to extend Symfony\Component\Console\Command\Command
            new OtherConsoleCommand(),
        ],
    ],

    // in zend framework applications this section is called 'service_manager'
    'dependencies' => [
        'factories' => [
            'Example\Console' => ConsoleConfigResolver\Factory\ConfigResolverFactory::class,
        ],
    ],
];

Under the key commands you can provide commands which will be added to your application. These have to either be a class name or an object instance extending Symfony\Component\Console\Command\Command., (*7)

Now in your code you can use the service manager to create the console application instance, e. g. in a file called console.php you can do it like this:, (*8)

#!/usr/bin/env php
<?php

chdir(dirname(__FILE__));

call_user_func(function () {
    // get your service manager instance
    $container = require 'config/container.php';

    // create the console application as configured in the example above
    $console = $container->get('Example\Console');

    // run the application
    $console->run();
});

Run the application in a terminal, e. g., (*9)

$ php console.php list

The Versions

18/05 2017

dev-master

9999999-dev

Simply create a symfony console application instance via zend-servicemanager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Wendrich

configuration console zend-servicemanager symfony-console

18/05 2017

0.2.1

0.2.1.0

Simply create a symfony console application instance via zend-servicemanager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Wendrich

configuration console zend-servicemanager symfony-console

18/05 2017

0.2.0

0.2.0.0

Simply create a symfony console application instance via zend-servicemanager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Wendrich

configuration console zend-servicemanager symfony-console

11/05 2017

0.1.1

0.1.1.0

Simply create a symfony console application instance via zend-servicemanager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Wendrich

11/05 2017

0.1.0

0.1.0.0

Simply create a symfony console application instance via zend-servicemanager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Daniel Wendrich