Note: Magento 2 development environment in general

Abhishek Jakhotiya
2 min readOct 20, 2020

--

Of course you gotta have PHPSTORM.

  1. Install nginx,php-fpm and composer, nodejs
  2. all projects go in /var/www directory
  3. nginx conf file name for domain names used on local should have pattern example.to.conf
  4. https://www.npmjs.com/package/maildev Setup maildev for local email testing.
  5. bashrc contains code to show me current git branch I’m working on
  6. Install and setup xdebug, easy with php storm
  7. Install Magento 2 phpstrom plugin by going to settings->plugins. Enable Magento support and if required enable MFTF support.
  8. Always keep magento 2 on developer mode
  9. php memory limit to be 1GB
  10. Install Postman for api related work. (Learn it, super useful)
  11. percona-server with 50% ram allowed to innodb_buffer_pool_size
  12. Have a laptop with SSD, I bought one from western digital NVMe.
  13. In my IDE, configure running tests with phpunit
  14. ALT+C copies path from repository root
  15. ALT+SHIFT+C copies fully classified class names. This is frequently done.
  16. CTRL + O to jump to class and CTRL+SHIFT+O jumps to file
  17. CTRL + G jumps to a line and CTRL + ALT + L formats code
  18. Use vim. Be familiar with awk,sed commands
  19. Install strace and bcc, ebpf tools for performance exploration
  20. For all my ssh IPs I maintain an alias in /etc/hosts. So that I can always do abhi@staging1.ssh abhi@staging2.ssh

Autokey

Often I have to create a Magento user on server or login to mysql using the command line. I found autokey-gtk really helps me with this.

sudo apt-get install autokey-gtk

basically I wanna be able to hit ALT+M and something like following should appear in my terminal. I don’t want to save this command in some text file. Because then I’ve to open the text file, copy the text and paste it. Very tedious.

php -r '$a = include("app/etc/env.php");extract($a["db"]["connection"]["default"]); echo "mysql -h {$host} -u $username --password=$password  $dbname ".PHP_EOL;'

--

--