Note: Magento 2 development environment in general
2 min readOct 20, 2020
Of course you gotta have PHPSTORM.
- Install nginx,php-fpm and composer, nodejs
- all projects go in /var/www directory
- nginx conf file name for domain names used on local should have pattern example.to.conf
- https://www.npmjs.com/package/maildev Setup maildev for local email testing.
- bashrc contains code to show me current git branch I’m working on
- Install and setup xdebug, easy with php storm
- Install Magento 2 phpstrom plugin by going to settings->plugins. Enable Magento support and if required enable MFTF support.
- Always keep magento 2 on developer mode
- php memory limit to be 1GB
- Install Postman for api related work. (Learn it, super useful)
- percona-server with 50% ram allowed to innodb_buffer_pool_size
- Have a laptop with SSD, I bought one from western digital NVMe.
- In my IDE, configure running tests with phpunit
- ALT+C copies path from repository root
- ALT+SHIFT+C copies fully classified class names. This is frequently done.
- CTRL + O to jump to class and CTRL+SHIFT+O jumps to file
- CTRL + G jumps to a line and CTRL + ALT + L formats code
- Use vim. Be familiar with awk,sed commands
- Install strace and bcc, ebpf tools for performance exploration
- 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;'