Web Analytics

Fill the form & Get Installation Support

Magento 2: How to create a custom console command and run code using the command?

Here is a simple hello world command run using the command

– Please create the following module for command :


  • Create a new model class, it will contain the options, description, and logic of your command.



    Now, run upgrade command to register module : bin/magento setup:upgrade

    To run the command, just create :

Then add your own logic under the execute() method.

Please let us know if this article is helpful to you.

Fill the below form if you have any Magento programming need.

    Recent Articles

    Author Info

    Hire n. jethva

    Get a Free Quote

      /* second popup */

      Connect With Us