slimphp / Slim-Console

Slim Framework Console
https://slimframework.com
MIT License
28 stars 12 forks source link

Console Framework / Task Runner Framework #2

Closed l0gicgate closed 4 years ago

l0gicgate commented 4 years ago

As per the original thread we discussed a few different frameworks that we could use as the underlying console runners. Namely:

Console Runners

Task Runners

We seemed to have more positive feedback around symfony/console. I am very familiar with their system and they will be providing long term support for the repo but let's look at the dependency overhead:

{
    "require": {
        "php": "^7.2.5",
        "symfony/polyfill-mbstring": "~1.0",
        "symfony/polyfill-php73": "^1.8",
        "symfony/polyfill-php80": "^1.15",
        "symfony/service-contracts": "^1.1|^2",
        "symfony/string": "^5.1"
    }
}

On the other hand we have phpleague/climate but my concern is that the package is soon going to go unmaintained. The repository has issues/PRs that go back all the way to 2014:

{
    "require": {
        "psr/log": "^1.0",
        "php": "^7.1",
        "seld/cli-prompt": "^1.0"
    }
}

I'm open to other suggestions for frameworks / task runners.

ABGEO commented 4 years ago

@l0gicgate I highly recommend Symfony Console. This is a thing that have everything we want to create a solid CLI application, despite its dependencies. As for Robo, It has Symfony Console in dependency, i think better to use the Symfony Console directly.

zhorton34 commented 4 years ago

As a core slim package going with the more stable option seems safer for preventing major breaking changes in the long term.

The console entry point will also be separate from the http entry point. Although potentially we may consider setting up something to allow http requests to trigger console commands, we could majorly partition the console dependencies from the http dependencies.

odan commented 4 years ago

I think Symfony Console is the "golden standard" in the PHP ecosystem. In Slim 4 everything has been abstracted via interfaces. But in this case it would (maybe) make more sense to re-use the Symfony console package and provide a simple interface for Slim commands. There is no PSR / FIG interface for this use case. However, this package could provide its own interfaces, for example

File: Slim\Console\Interfaces\CommandInterface.php

<?php

namespace Slim\Console\Interfaces;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

interface CommandInterface
{
    public function execute(InputInterface $input, OutputInterface $output): int
}
RyanNerd commented 4 years ago

Whereas Symphony Console is the "gold standard" for CLI in PHP, Robo is the "gold standard" for task runners. Separate question: Are we planning on using DI in this project (I nominate http://php-di.org/ as the default) with the ability to add/replace with any DI that follows the PSR standards.

l0gicgate commented 4 years ago

@RyanNerd see #3