Tutorials
IDE Helpers
Theme
Documentation
- Quick docs:
F1
- External docs:
shift + F1
- Method parameter information:
cmd + p
- Search in Dash:
cmd + shift + d
(requires Dash plugin)
It seems, with the latest MAcOs updates, that Java was also updated, which influenced PhpStorm performance very badly. Anyway, I decided to update my Java. Was $ java -version java version '1.6. PhpStorm is a lightweight and smart PHP IDE focused on developer productivity that deeply understands your code, provides smart code completion, quick navigation, and on-the-fly error checking. It is always ready to help you shape your code, run unit-tests, or provide visual debugging.
Shortcuts
Basics
- Paste from history:
shift + cmd + v
Selection
- Expand selection:
alt + up
- Multiple cursors:
alt + click
(add and also remove) - Select next of kind:
ctrl + g
- Select all of kind:
ctrl + cmd + g
- Move selection:
alt + shift + up
/alt + shift + down
- Remove line:
cmd + backspace
Macos Install Phpstorm
Search
- Search everywhere:
shift + shift
- Search for action:
cmd + shift + a
Refactor
- Refactor:
ctrl + t
Format
- (Re-)Format code:
alt + cmd + l
Create & Scaffold
- Duplicate line:
cmd + d
- Create new file:
cmd + n
(within project sidebar) - Create temporary scratch file:
cmd + shift + n
- Scaffold code:
cmd + n
(within object) - Initialize fields:
alt + return
- Quickfix:
ctrl + return
- Import class namespace:
alt + return
Structure & Navigation
- Show structure of current file:
cmd + F12
- Select recent files:
cmd + e
- Jump to declaration:
cmd + b
- Jump to previous caret (text cursor) position:
alt + cmd + left
- Jump to next caret (text cursor) position:
alt + cmd + right
- Jump to current file (Scroll from Source):
alt + F1 > 1
oralt + F1 > enter
- Open file:
cmd + shift + o
Debug (Xdebug required)
- Setup Xdebug: https://gist.github.com/hofmannsven/9976152
- Debug:
ctrl + d
- Step into:
F7
- Step over:
F8
- Finish execution:
alt + cmd + r
- Stop debug:
cmd + F2
Autocomplete for external libraries
Add the global path as external library or require it via composer.
- External library:
/Applications/MAMP/Library/bin
- Composer dependency:
'phpunit/phpunit': '5.6.*'
Phpstorm Community
PHP Code Sniffer
Install
composer global require squizlabs/php_codesniffer
- Alias:
alias phpcs='/Users/username/.composer/vendor/bin/phpcs'
Activate
- PhpStorm: Settings » Editor » Inspections » PHP » PHP Code Sniffer validation (PSR2)
Macos Phpstorm Xdebug Not Working
Configure
Macos Update Phpstorm
- PhpStorm: Languages » PHP » Code Sniffer