5 FREE Developer Tools Every Magento 2 Programmer MUST Have

Mark Shust demos five free tools for Magento 2 developers: N98 Mage Run 2's interactive PHP console, the QuickDev Bar debug toolbar, a module that auto-disables two-factor auth in dev mode, the bin/magento dev:di:info command for dependency injection details, and Finai's Cache Clean Project for automatic cache clearing.
Questions this video answers
January 20, 2023.
Over half a million downloads.
Chapters
Do you want to vastly improve your day to day routine as a Magento developer? Well, these five modules can help you do just that. And you'll want to watch this video all the way to the end because I saved the best for last. Let's get started. N98 Mage Run 2 is the Swiss army knife for Magento and goes all the way back to the Magento 1 days. But this tool is still around for Magento 2. You would have thought the Bin Magento script would have replaced it, and in many ways it actually has. But there are still some absolute gems in in Mage run. That said, one of the commands in this tool sticks out far above and beyond all of the other commands, and that would be the Dev Console command. This Repl command line tool allows you to drop right into an interactive PHP shell, and the best part is that it has full local integration with Magento, allowing commands to be carried out extremely fast and without delay. The special DI variable provides you direct access to the object manager, allowing you to easily create objects with dependency injection with right from the command line. This dev tool allows you to write just about any Magento command locally and have it immediately execute. The dev console can be really useful for running one off commands or to just test out some code that you may want to integrate later. This allows you to write code right away without needing to create something like a controller to get access to the code and dump out data. You can also use it to walk through all of the different areas of Magento for learning purposes, which will help you figure out how everything works. The There are many developer tools out there, but many are outdated, don't work, or cost money. The QuickDev Bar is one of the open source dev toolbars, and it's actually as old as Magento 2 itself. After quickly installing it, just like any other Magento module, you're able to activate it by adding your IP address to the allowlist. Since I use Docker, I'll need to add my Docker IP address to this list. After saving it and clearing the cache, a little icon appears at the top left of the Magento instance. Clicking on it opens a toolbar, which then displays all sorts of debugging info about Magento. This includes anything from the HTTP request data being passed to the framework to the output of the phpinfo function. Let's check to see what's available in all the other tabs. Design has layout handles and block classes. Profiler has info on the Mage profiler a list of all observers fired off when the page is loaded, events that were dispatched, all collections and models that were called, and all the various plugins and methods that were executed when the page was loaded. Looking at the Queries tab, this shows all the raw SQL queries that were executed on this page. This can be extremely useful when trying to find slow running queries or if you are wondering why a certain repository is only loading a specific set of data. This list of raw SQL queries, their estimated runtime and and the ability to sort them by the time it took them to execute is one of the best features of this toolbar. Every developer hates trying to trudge through log files, but since the toolbar displays the contents of all the log files in one place, it makes for a much more pleasant developer experience. You can also reset the contents of each individual log file by just clicking the related Reset button. Included in the Actions tab is just a simple toggler which turns on or off different developer settings, and a handy Flush Cache button which clears out the cache faster than the Flush Cache button built into Magento. And finally, the Translations tab doesn't work. Yeah, it's not perfect, and this toolbar definitely has some bugs here or there, but I'm running php 8.1 so it seems that this module hasn't either been updated for the most recent version of Magento 2, but hopefully a few extra fixes are on the way that take care of these issues in the future. Overall, this toolbar is so extremely helpful when it comes time to figuring out what's going on in your Magento store. And having access to all of this private hidden data is so invaluable. As a Magento developer, I'm a bit biased as I created my next favorite module which is the disable two factor auth module. When Magento 2.4 was released, it forced developers to set a 2fa key, which meant you needed to type in your two factor auth code every time you logged into the admin during development. This change really put a damper in your development workflow, so I created this module so that doesn't happen. This little module detects if you're in developer mode, and if you are, it automatically disables two factor auth for you. This is a great alternative to just disabling the two factor auth module on your developer machine, because you just know that one of these days you're going to wind up committing that disabled module to version control and it will eventually accidentally make its way into production. This has the potential to open up security holes in your online store and causes unexpected things to happen. And disabling two factor Auth altogether isn't an option, because the entire reason two factor Auth was introduced in the first place was to lock down access to your very important store admin. The best part of the Disable two factor Auth module is that it's a module that you can just install and forget about when the module gets pushed upstream. Two factor Auth will remain enabled on your staging and production systems because those sites never run in developer mode. And of course, you can always just disable two factor Auth completely from the admin with this module in the event that you need to diagnose or debug an issue with two factor Auth on production. This module provides you with a lot of flexibility and it's quite widely used with over half a million downloads at the time of this recording okay, this tool is a bit of a cheat because that's built into Magento, but I just couldn't leave it out of this list. When you run Bin Magento and check its output, you'll see a flag that is not really widely known. Named Dev di Info, this one helps you realize exactly what's going on under the hood of Magento's dependency injection system. All you have to do is type out this command and then follow it with a quoted string of the interface you'd like more info about. For example, to get more info about Magento Framework's request interface, you would type Bin Magento Dev di Info Magento Framework App Request Interface that output that is returned completely demystifies which interface preference is used, which constructor arguments implement this interface, along with any related plugins that hook into it. If you use phpstorm as your ide, all of this info has always been available to you through highlights, annotations, and hints. But this little CLY command puts all of this info into one convenient spot. If you have a problem area with a specific implementation of an interface, or or completely stuck debugging it, this command can really help you out in a pinch. It's a very welcome addition to your code debugging arsenal. That's four tools, which means there is only one left. But before I move on to my favorite Magento Dev tool, if you found this video helpful or learned anything new, please hit that like button to show support for my channel. And if you want to be in the know about any other Magento coding stuff, please consider subscribing to it. I really appreciate it. We finally made it all the way to the fifth and final item in this video, which means that it is my number one Magento dev tool, and one of the most aggravating parts of Magento is the need to constantly clear the cache. Remember that meme from magento1? Keep calm and clear the cache? Well, it's still very much around for Magento 2 and hasn't really gotten any better. It feels as if we're constantly clearing the cache with everything we do, and it really slows down the development workflow. What if I told you you'd never really need to clear the cache again? Like, ever? Finai's Cash Clean Project is your personal Magento cash butler and concier, and it's a worker bot that just sits around in the background and waits. Whenever you edit any file in Magento, your personal assistant gets to work, detects which caches were affected, and automatically cleans and purges them out for you. The first time I saw this in action, it was magical. But after developing in Magento 2 for some time now, I really can't imagine not using it. It's super easy to install and you can run it with a single command. And if you use my Docker Magento Project for your development environment, it's already built in and running for you from the first time you the Cache Clean module saves more time than any other tool, which makes it my favorite developer tool for Magento 2. I hope you really like this list. And if you like the possibilities of N98 Mage Run's dev console command, there's another option that you'll really want to check out called Tinkerwall. If you want to see how I can so very quickly debug Magento with Tinkerwall, you want to check it out in the next video.










