Skip to content

xtreamwayz/mezzio-console

Repository files navigation

No Maintenance Intended

Thank you so much for being interested in this project! Open Source is rewarding, but it can also be exhausting. Therefor this code is provided as-is, and is currently not actively maintained. We invite you to peruse the code and even use it in your next project, provided you follow the included license!

No guarantee of support for the code is provided, and there is no promise that pull requests will be reviewed or merged. It’s open source, so forking is allowed; just be sure to give credit where it’s due!


Symfony Console for Mezzio

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.