How to apply the Magento 2 patches?

Most of Magento developer want to know exactly how they should apply the security patches on their websites

in this article we are going to talk about *.patch files

There are two ways to do this

1- using  git command

git apply patch_filename.patch


2- using patch command

patch -p1 < patch_filename.patch


I hope this will be useful for you


How to enable profiler in magento2

To enable the profiler we can add it from index.php or apache/nginx conf file.

Enable Profiler from index.php:

  1. Open {magento root}\pub\index.php from magento2
  2. Add following line from the file $_SERVER[“MAGE_PROFILER”]=”html”;
  3. Clear cache you can able to see the profiler.


Enable profiler from apache conf or magento2 .htaccess :

Flash Catalog Images Cache Magento2

To flash the Catalog Images cache, first of all instantiate the Object and Event Manager in your constructor


private $objectManager;
private $eventManager;

public function __construct(
    \Magento\Framework\ObjectManagerInterface  $objectManager,
    \Magento\Framework\Event\Manager $eventManager
     $this->objectManager = $objectManager;
        $this->eventManager = $eventManager;

After that you can clean the catalog images cache by using this two code lines

Subscribe to magento2