phpStorm Tips and Tricks for Mac

March 21, 2022

Free Tutorial

https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/2

Close/Open File Browser

command + 1

Open up a class

command + o

Navigate -> Class...

Open up a symbol

A symbol is like a controller method (i.e. actionRun)

option + command + o

Navigate -> Symbol...

Open up a file

shift + command + o

Navigate -> File...

Turn off Unnecessary clutter

View -> Appearance -> Navigation Bar

View -> Appearance -> Status Bar

View -> Appearance -> Tool Window Bars

Turn off editor tabs

preferences -> Editor -> Editor Tabs -> tab placement -> none

Search for anything and everything

Shift + Command + A

Browse File Structure

Command + F12

Create New Files and Directories with Keyboard

Command + Up arrow

Use the arrow keys to move to the folder you want. Press command + n when you want to create something new.

Make sure to select the file type you are using to save some keystrokes (i.e. PHP class)

You can also create your own file type and template

Show Recent Files List

command + E

to toggle back and forth quickly press command + E and then enter.

Selecting Code Blocks with Keyboard

option + up arrow as many times as you need to get the block you need

Code Snippets

Select the code block you want and press shift and shift again. type in live template and select save as live template. Make sure to select the appropriate applications.

You can also add $var$ in your code snippet so that when you fill out one part it will automatically fill out the other parts where the save value applies.

You might want to disable Emment -> HTML in the preferences for now.

You can also edit variables and use functions on those variables.

Here is a screen shot example of a code snippet from the video:

Code Snippets in phpStorm
From the "Be Awesome in PHPStorm" Tutorial from Laracasts

Copy / Cut a line

place cursor any where in the line and press command + c or command + x and it will automatically do the whole line.

Refactoring

You can select lines of code and press control + t. Then you can refactor in various ways. One way is the use the selected lives and extract them into their own method automatically. Another is to put your cursor into a method name and then press control + t to rename the method where ever it exists.

You can also refactor and pull a method up to the parent.

Refactoring Class File Name

Place cursor in class name, and then press control + t and then select rename.

Refactor: Extract Interface from Class

Place your cursor in the class name, control + t, and then extract interface

Refactor: Variable

Put your cursor over a value, press control + t, and then variable. You can do the opposite with inline

Generate a Constructor

Command + n and then constructor

Initialize Field

Press option + return and then initialize

Convert Class Path to Use

Press option + return and import class

Multiple Cursor Auto Select

Put your cursor in the first word for multiple cursor and then press control + g and keep pressing it until all the instances are selected.

You can also automatically select all the instances all at once by pressing control + command + g

Add Edit Split Right and Down Keyboard Shortcuts

I added option + R option + d

Book Reviews

I am nuts about books. I read on all kinds of topics. I attempt to review each book I read for the sake of my own enrichment as well as conversation starters with others.

My Book Reviews
The Attic

You never know what you will find in an attic! Usually there is a hodgepodge of things buried under dust.

Explore the Attic
Technology

Most of what is included here are notes to myself. The majority of folks will not find interest in these posts.

Technology Posts