PHPackages                             dwendrich/console-config-resolver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. dwendrich/console-config-resolver

ActiveLibrary[CLI &amp; Console](/categories/cli)

dwendrich/console-config-resolver
=================================

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

0.2.1(8y ago)034MITPHP

Since May 11Pushed 8y agoCompare

[ Source](https://github.com/dwendrich/console-config-resolver)[ Packagist](https://packagist.org/packages/dwendrich/console-config-resolver)[ RSS](/packages/dwendrich-console-config-resolver/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

console-config-resolver
=======================

[](#console-config-resolver)

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

[![Build Status](https://camo.githubusercontent.com/e626e0f75954450ddd2f6ff78be17fb59025026cb1c536351c15998eb967943d/68747470733a2f2f7472617669732d63692e6f72672f6477656e64726963682f636f6e736f6c652d636f6e6669672d7265736f6c7665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dwendrich/console-config-resolver)[![Coverage Status](https://camo.githubusercontent.com/d3f9e4e337a24e883db9d658c1de8661afdcb370feeb577ffed4e3be57e0837f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6477656e64726963682f636f6e736f6c652d636f6e6669672d7265736f6c7665722e737667)](https://codecov.io/gh/dwendrich/console-config-resolver)[![Latest Stable Version](https://camo.githubusercontent.com/be24132821d8dde9f0249bc84cf89444cc0deb2b8f759ced373a5807bd1ebe40/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6477656e64726963682f636f6e736f6c652d636f6e6669672d7265736f6c7665722e7376673f7374796c653d666c6174)](https://packagist.org/packages/dwendrich/console-config-resolver)

Requirements
------------

[](#requirements)

- PHP 7.0 or higher
- [Symfony Console component 3.2 or higher](https://github.com/symfony/console)
- [Zend Framework Service Manager component 3.3 or higher](https://github.com/zendframework/zend-servicemanager)

Installation
------------

[](#installation)

ConsoleConfigResolver can be installed with composer. For information on how to get composer or how to use it, please refer to [getcomposer.org](http://getcomposer.org).

Installation via command line:

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

Installation via `composer.json` file:

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

Usage
-----

[](#usage)

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

```
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`.

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:

```
#!/usr/bin/env php
