Question

I am trying to create my own script to be placed in my extension /bin folder so that once I finished it, it should work in this way

bin/mycommandname my-customcommand

instead of running the

   bin/magento 

Is there any documentation or something which someone can help me out in this regard ?

Was it helpful?

Solution

First of all you should NOT add anything in folders other than app/code , app/design app/i18n. I think some scripts at magento root might also be acceptable but putting files in bin definitely isn't.

You can create a module for doing just what you asking for thanks to symphony's implementation in magento.

There is an article about making a simple console command here - http://devdocs.magento.com/guides/v2.2/extension-dev-guide/cli-cmds/cli-howto.html

Also here is sample module -

https://github.com/magento/magento2-samples/tree/master/sample-module-command

Hope it solved your issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top