Dark side propaganda

PRESENTS

Becoming a

PhpStorm

TROOPER

THE PLAN

  1. Plugins

  2. Commands

  3. Ressources

PLUGINS

SYMFONY PHP COMBO

Symfony 2 plugin

Awesome plugin with too many things to details here, a must have !

\0/ and fixed for PhpStorm 2016.1


PHP Annotation

Bring completion 

to all annotation stuff !


PHP Toolbox

Great plugin adding even more completion (play well with the symfony plugin)

Adds code completion, inspections and more to composer.json file.

Simply put your .editorconfig file(s) in place according to the instructions at editorconfig.org site, and the plugin will enforce them.

 

EditorConfig settings will silently override the normal settings configured in the IDE for all files controlled by EditorConfig.

 

That is, if your IDE's settings say to use 4-space indents in Java files, but your EditorConfig settings enforce 2-space indents in all the files under the "src" directory, then hitting tab will insert 2 spaces on Java files in "src", but 4 spaces in all other Java files in the project.

highlight & completion

Some useful snippets for lazyness

Bootstrap 3 live templates / snippets

COMMANDS

DISCLAIMER

KEYBOARD SHORTCUTS DEPENDS ON YOUR OS AND KEYMAP SETTINGS

KEYBOARD SHORTCUTS WITH A RED BACKGROUND ARE MY RECOMMANDATIONS FOR NEWCOMERS

 

NAVIGATE &

FINDING THINGS

 

SEARCH

CMD + SHIFT + F

CTRL + SHIFT + F

CMD + F

CTRL + F

SEARCH in files

Did you know that for easy finding you can type only the camel cased letters ?

FIND NEXT

CMD + SHIFT + G

SHIFT + F3

CMD + G

F3

FIND PREVIOUS

SEARCH & REPLACE

CMD + SHIFT + R

CTRL + SHIFT + R

CMD + R

CTRL + R

SEARCH & Replace in files

Did you know that for easy finding you can use regex like *.twig ?

FIND EVERYTHING !

SHIFT + SHIFT

SHIFT + SHIFT

Great command to learn when you start to use PhpStorm

This shortcut is great because you search across files, classes, commands, symbols etc

BUT ...

... IT COMES with a serious performance cost

 

 

 

SO IF YOU HAVE SLOW MACHINE OR ARE A LITTLE BIT PERFECTIONIST

LEARN THE DEDICATED COMMANDS !

FIND CLASS

CMD + SHIFT + O

?

CMD + O

?

FIND file

CMD + SHIFT + A

CTRL + SHIFT + A

FIND COMMAND

FIND SYMBOL

CMD + ALT + O

?

GO TO LINE

CMD + L

CTRL + G

When you're searching a file you can use

this kind of syntax to reach a particular line :

 

admin.css:23

BRIEF INFO

CMD+HOVER

CTRL+HOVER

Go to declaration

CMD+CLICK

CTRL+CLICK

 

PRODUCTIVITY

 

MARKING DIRECTORY

An important thing to learn is marking directory in PhpStorm AT LEAST :

(Right click on a folder)

Excluded : exclude the directory from parsing, in symfony project for example exclude the cache and logs folder

Resource Root : tell PhpStorm where he can find resources ( / ), for example you have multiple warnings in your css because PhpStorm can't find all images resources, mark the web directory of your symfony project as a Resource Root, now PhpStorm will find and correctly assist you. (same thing for, for example, a project with a funky setup on twig template)

QUICK FIXES

ALT + ENTER

ALT + ENTER

Great command to learn when you see a light bulb or some "yellow waves" do the shortcut and see what PhpStorm propose to help you.

 

It really does MANY things depending the context so have a try !

EMMET

TAB

TAB

Built-in PhpStorm

 

Quick and nice way for writing html

 

Find out more on the emmet website.

 

Link to emmet cheat sheet at the end in the ressources part.

Surround with

CMD+ALT+T

CTRL+ALT+T

PHP CONTEXT

JS CONTEXT

HTML CONTEXT

Surround with

CMD+ALT+T

CTRL+ALT+T

You can make a combo with emmet too

HTML CONTEXT

REFORMAT

CMD+ALT+L

CTRL+ALT+T

Generate

CMD+N

Alt + Insert

Live TEMPLATEs

Live template are a feature turning a keyword to a bunch of code.

blk

[Tab]

Example in a twig context

To see available live templates and create your own

GO To PHPSTORM SETTINGS, TYPE "Live template' in the search input on the top left

Multi cursor

ALT+CLICK

Alt + CLICK

Tip : If you click and drag you can select by "column"

Toggle case

CMD+SHIFT+U

CTRL+SHIFT+U

Paste from history

CMD+SHIFT+V

CTRL+SHIFT+V

COPY REFERENCE

CMD +ALT+ SHIFT + C

?

When yo do this on a file you get this in your clipboard : src/AppBundle/Resources/public/assets/css/admin.css

When yo do this on a class name you get this in your clipboard : \AppBundle\Form\ProductType

If you need the full path use the copy path command :

/Users/sylvain/Projets/acteon/acteon/web/assets/images/sprite.png

COPY PATH (with project file or folder selected)

CMD + SHIFT + C

?

RESSOURCES

   Help > Tip of the day

   Help > productivity guide

FROM PHPSTORM IDE

DOCUMENTS

VIDEOS

TWITTER

Thank you !

Becoming a phpstorm trooper

By Sylvain Combes

Becoming a phpstorm trooper

Tips and tricks about phpstorm

  • 268
Loading comments...

More from Sylvain Combes