While using Magento 2, you are probably familiar with tons commands and executed multiple times. By default, Magento comes with preloaded SSH features that allows you to securely log into remote server or system and execute commands. Basically, SSH was designed to provide secure communications between two untrusted networks. But have you ever wondered where how these commands were created and how to create your own command?
In today’s blog, I will show you how to create your own SSH command in Magento 2 with simple steps. We need to create two files to override default Magento files using a custom Magento 2 extension. Here, I have demonstrated simple SSH command to see extension is enabled or not?!?!
Firstly, We need to Point Command List Class in ‘di.xml‘
Code :
app\code\Vendor\Extension\etc\di.xml
Vendor\Extension \Console\Command\Cod
In our custom class, we need to override two default methods among that one for execution and second for configuration. That’s why we have created another file ‘enable.php‘ at below location in our custom extension folder.
app\code\Vendor\Extension\console\command\enable.php
Don’t forget to tell us, how you have used this code to create your own command. If you are looking for more help regarding this code kindly comment down below. Happy SSH!
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…
The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…
Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…
Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…
We're thrilled to announce the release of Hyvä Themes 1.3.6 and 1.3.7! These latest updates…
Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…