Prep environment for admin grid development

Before starting Magento development, there are a few things you need to do to prepare your environment. This lesson will walk you through the steps to make your development process smoother and more efficient.

Disabling Two-Factor Authentication

When logging into the Magento admin, you may notice a message prompting you to set up two-factor authentication (2FA). While 2FA offers added security, constantly entering 2FA codes during development can be a hassle. To address this issue, you can use a module called DisableTwoFactorAuth. This module allows you to control whether 2FA is enabled or disabled, depending on your environment.

To install this module, follow these steps:

  1. Use Composer to install the module by executing the appropriate command in your terminal.
  2. Enable the module in Magento by executing the required command in your terminal.
  3. Clear the cache by running the bin/magento cache:flush command.

Remember that 2FA is still enabled by default after installing the module. You can disable it either through the admin panel or by running the appropriate command in your terminal.

Enabling Developer Mode

Enabling developer mode is crucial for Magento development. This mode allows for easier debugging and other useful features when working on your project. To enable developer mode, follow these steps:

  1. Open your terminal and check if developer mode is enabled by running the bin/magento deploy:mode:show command.
  2. If the current mode is “default”, change it to “developer” by running the bin/magento deploy:mode:set developer command.

Installing and Configuring IDE Plugins for Magento

Installing and configuring the appropriate Magento plugin for your Integrated Development Environment (IDE) can greatly improve your development workflow. For example, the Magento PhpStorm plugin offers several useful features, such as command-clicking into XML files.

To set up the PhpStorm plugin, follow these steps:

  1. Open PhpStorm and navigate to Preferences > Plugins.
  2. Click on the Marketplace tab and search for “Magento”.
  3. Install the Magento PhpStorm plugin and restart PhpStorm.

After installing the plugin, enable it for your current project by going to the Languages & Frameworks > PHP > Framework section in PhpStorm’s preferences. Make sure to check the “Enable Magento integration” box and set the correct local installation path and Magento version.

Improving Cache Management with the Magento-Cache-Clean Module

The magento-cache-clean module by Vinai Kopp can significantly improve your development experience by automatically clearing caches when changes are detected in your project. To install this module, follow these steps:

  1. Install the module with Composer by executing the appropriate command in your terminal.
  2. Start the cache watcher by running the required command in your terminal.

With this module installed, you no longer need to manually flush caches when making changes to your project.

Enabling Magento Coding Standards

It’s a good idea to enable the official Magento Coding Standards for your development. These standards are recommended by Magento and are required for submitting modules to the Magento Marketplace. To enable these standards, follow these steps:

  1. Install the Magento Coding Standards with Composer by executing the appropriate command in your terminal.
  2. Add the necessary lines to your composer.json file.

Finalizing Your Environment

With your environment prepared, you can now log into the Magento admin and make some final adjustments. To avoid having to constantly log in during development, increase the admin session lifetime to the maximum value (one year). This can be done by navigating to Stores > Configuration > Advanced > Admin > Security, and adjusting the “Admin Session Lifetime” setting.

After making these changes, flush the Magento cache, and you’re all set to start your Magento development.

Complete and Continue  
Extra lesson content locked
Enroll to access all lessons, source code & comments.
Enroll now to Unlock