xtreamwayz/mezzio-console

Symfony Console for Mezzio

1.4.0 2021-12-09 19:05 UTC

README

Symfony Console for Mezzio

Continuous Integration

This packages brings Symfony Console to your Mezzio project. It uses the FactoryCommandLoader for lazy loading dependencies. The FactoryCommandLoader does almost a good job: It only loads the one command that is required. But if no command is requested, it still initializes all commands to get the descriptions for each command. This is fixed by using a LazyLoadingCommand. With a bit of reflection and magic it grabs the configuration from the original command while preventing the command from executing. This way you end with a list of all commands and their descriptions.

Installation

$ composer require xtreamwayz/mezzio-console

Configuration

<?php

declare(strict_types=1);

namespace App;

return [
    'dependencies' => [
        'factories' => [
            Console\MyCommand::class      => Console\MyCommandFactory::class,
            Console\AnotherCommand::class => Console\AnotherCommandFactory::class,
        ],
    ],

    'console' => [
        'commands' => [
            'my:command'      => Console\MyCommand::class,
            'another:command' => Console\AnotherCommand::class,
        ],
    ],
];

Documentation

All project documentation is located in the ./docs folder. If you would like to contribute to the documentation, please submit a pull request. You can read the docs online: https://xtreamwayz.github.io/mezzio-console/

Contributing

BEFORE you start work on a feature or fix, please read & follow the contributing guidelines to help avoid any wasted or duplicate effort.

Copyright and license

Code released under the MIT License. Documentation distributed under CC BY 4.0.