Cons and pros of using Symfony Console


(Schmunk) #21

I second that!

Another thing, maybe slightly OT, but … could we migrate to a syntax like yii ctrl action without the slash? Most CLI tools use this kind of syntax and I can’t remember a single one using a /.


What would be your preferred console syntax?
#22

Actually, I like current syntax and I think it was a huge improvement compared to Yii 1.1 (which uses ./yiic controller action arguments syntax) - it is more consistent with web controllers and how routing in Yii works, so it is much more intuitive for me. It is also much clear what part of the command is a route to action and what part is the action arguments.


(Schmunk) #23

To me the similarity to web controllers was always more confusing than helpful.

How does Symfony Console handle this … AFAIK with a colon :?


#24

AFAIK they don’t have controllers at all, only actions (commands). Using : is only a convention to group commands in namespaces, but there is no restrictions for this (you probably could use / instead). In this context it is simillar to Yii 2 - there is one argument for command name/route.


(Alexander Makarov) #25

@rob006 is correct. There’s a single argument for it in Symfony.

For now I’ve adopted Symfony Console directly. Going to focus on other parts for a while. If you want to take care about having our own interfaces meanwhile, let me know.


(Schmunk) #26

Poll about the syntax: What would be your preferred console syntax?


(Schmunk) #27

I just stumbled upon https://climate.thephpleague.com/ - would it be possible to integrate it in Yii 3.x or would it rather be a replacement of the console tool?

Bonus question: What’s about Yii 2?


(Insolita) #28

There are no problems for using Climate with yii2
see https://github.com/Insolita/yii2-codestat/blob/master/src/controllers/DefaultController.php

If yii3 will use symfony-based console see https://github.com/duncan3dc/symfony-climate/blob/master/src/Output.php
example


(Insolita) #29

Yet another pros for symfony-based console is may be better compatibility/adoption with existed symfony/console decisions


(Schmunk) #30

Is it no problem, that it does not use $this->stdout()?


(Insolita) #31

Seems i don’t understand you. You want to output climate formatted data via yii $this->stdout()?

You also can do it, for example via buffer

see https://climate.thephpleague.com/output/


(Schmunk) #32

Nice, thank you!


(jakim) #33

Faster (in implementation) solution at the beginning, with time, if necessary, own implementation.