Skip to content

Instantly share code, notes, and snippets.

@alexqhj
Last active June 2, 2017 18:16
Show Gist options
  • Save alexqhj/8b434e75e7208f62edeb24bd277306da to your computer and use it in GitHub Desktop.
Save alexqhj/8b434e75e7208f62edeb24bd277306da to your computer and use it in GitHub Desktop.
Setting up PhpStorm on Ubuntu

Installing PhpStorm

sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer
sudo apt-get install oracle-java9-set-default
cd ~/Downloads
wget https://download.jetbrains.com/webide/PhpStorm-2016.3.2.tar.gz // replace with latest version
tar -xvf PhpStorm-2016.3.2.tar.gz
sudo mv PhpStorm-163.10504.2 /opt/phpstorm
rm PhpStorm-2016.3.2.tar.gz
ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm

Installing and configuring Material Peacock

PhpStorm theme by @daylrees

File | Settings | Plugins -> Browse Repositories

Install Material Theme UI Download/Copy material-peacock.icls into /home/USERNAME/.PhpStorm.VERSION/config/colors Install either Fira Code or Hack font

Restart PhpStorm

File | Settings | Editor | Colors & Fonts Select Material Peacock

Enabling phpcs Code Sniffer

Install phpcs using composer

composer global require "squizlabs/php_codesniffer=*"

In PhpStorm:

File | Settings | Language And Frameworks | PHP | Code Sniffer

Click the context menu for Configuration[Local] and enter the path for phpcs

/home/YOUR USERNAME/.composer/vendor/bin/phpcs

Then go to

File | Settings | Editor | Inspections

Find PHP and select PHP Code Sniffer validation, also remember to check the box to enable the inspection

Set the Coding Standard to PSR2

Useful Plugins

  • Laravel Plugin (Must enable per project in Settings | Languages and Frameworks | Php | Laravel)
  • Vue.js
  • Key Promoter (Shows the key binding for a mouse action to help productivity)

Prevent nbsp from messing up your braces in Ubuntu

I often had an issue when typing {{ into PhpStorm, it would add a no-break space (nbsp) character. This was because of my Norwegian keyboards AltGrkey that is used to produce the { character AltGr+7

If I did it too fast, the AltGr key would still be pressed down as I pressed space. Ubuntu's keybinding for nbsp is Altgr+space

To disable this, type this into your terminal

setxkbmap -option "nbsp:none"

Dead keys not working?

ibus-setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment