We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[SOLVED] Command Line Applications

Reading the documentation about CLI, that you can find here (https://phalcon-php-framework-documentation.readthedocs.org/en/latest/reference/cli.html), I don't understand how to make a command line application. A script that I can make executable and run from the command line. I want run commands like this:

pippo -help pippo -install pippo -import all pippo -import articles pippo -import users pippo -reset

etc.

So I remembered dev-tools have a command line app and I went to github to browse the code. And yes, I have just discovered that it has been used another approach, a classic builder with commands. So what?

For example should I just create a task called PippoTask, then many actions: mainAction, helpAction, importAction or I should instead create a task for every action, like HelpTask, InstallTask, ImportTask (and inside the ImportTask adding the methods allAction, articlesAction. etc.) ?

I'd really appreciate any hint.

Thx



24.4k
Accepted
answer

Just for the records, this helped me to understand how it works: https://gist.github.com/racklin/3658914

So... is your question [solved]?

Yes, you can close it, old thread.

I'm not an admin, but editing your original post and adding "[solved]" to the title would be helpful.