When starting Magento development, first thing you find out that in order to see the changes you have to clear the cache. There is also an option to disable the cache completely, but performance wise – it’s not a very smart move. As your experience on the system grows you are getting to know which exact cache to clear to see the changes, be it config, layout, FPC cache or any other. Nevertheless, these operations are pretty cumbersome as admin session times out from time to time. You may also know that enabling template hints is not a quick operation either.
Let me introduce a great tool which will simplify your life as a Magento developer and make it enjoyable: Mage Run, which is being developed by Christian Münch. Installation of the tool is fairly easy. This tool has loads of useful commands and when you get used to it you will not believe you’ve been doing all the actions from your Magento backend. There is a list of all available commands (which can be also displayed from tool itself by using command n98-magerun.phar list
), but here we want to describe a few favourite combos from our own work flow.
First one is useful when creating install and upgrade scripts. As you know, Magento checks if setup scripts need to be ran by checking module’s version which is in turn cached in the config cache. To test my newly created script we increase version of the module then issue n98-magerun.phar cache:clean config
followed by n98-magerun.phar system:run-setup-scripts
. If there are some errors or exceptions they will be displayed in the console, otherwise you will see “done.” and feel proud of yourself. :)
Next time-saving command is n98-magerun.phar dev:module:create
which allows you in a matter of seconds to create module skeleton and register it in the system. That could take you good five minutes creating folders and configs manually.
We also quite liked n98-magerun.phar install
command, which allows quick installation of required Magento version together with appropriate sample data.
Several useful commands were added just recently, they are dev:module:rewrite:list
and dev:module:rewrite:conflicts
. Modules rewrite conflicts – it was pretty hot topic on last MageConf and now there is a simple way to diagnose your system for the rewrite issues.
And here are a few toggler commands for the desert: n98-magerun.phar dev:template-hints
and n98-magerun.phar dev:profiler
We’re now quite confident you have already downloaded the tool by this sentence or way earlier. Please, post your use-cases or questions in the comments below. Thanks to Christian for sharing this awesome tool and here is hoping that by using it your Magento team is getting more productive and happy!
Afterword: to unlock new features and badges in the tool issue n98-magerun.phar self-update