40 PhpStorm Tips & Tricks

Powered by Mastering PhpStorm video course

#40
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #40 - Git Annotations

Need to check who changed a specific line of code? Or who else was working on this current file?

Git annotations are your friend. Handshake


#39
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #39 - Find in files

If you need to look for strings in your app you can select or copy the string and open "Find in Files". This way it will automatically paste this string and look for it. ✌


Ready for more?

Mastering PhpStorm Logo text

Tips & Tricks was just the beginning. In my new video course, I cover all the essential features of PhpStorm like Refactoring, Testing, Debugging, Git in detail.

Show Me
#38
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #38 - Complete Current Statement

Did you know about the "Complete Current Statement" shortcut? It tries to finish the current line of. 👏

(Default shortcut: Shift + CMD + Enter)


#37
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #37 - Replace quotes

How many times do you replace quotes? For me, definitely more than I want to :-)

I'm glad you can do that easily with a context action.


#36
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #36 - CLI Features

Did you know that you can use some features right from the command line? (thx @nuernberger_me)

- Create a launch script
- Open up file/project
- Open diff dialog
- Or merge dialog


#35
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #35 - Conditional Breakpoints

While debugging you are often only interested in one specific case that you want to take a closer look at.

That's when you should use conditions for your breakpoints.


#34
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #34 - Inline Watch

While debugging you often need to have quick look at specific values: Welcome inline watches

- Define what you need to see (with auto-completion of course)
- See it directly in the editor😮


#33
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #33 - Debug Collections

To debug collections or chained method calls with Xdebug you can evaluate every call separately at a breakpoint without changing the code itself. 😮


#32
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #32 - Toggle Class Template

Today's tip was brought to me by @freekmurze.

When creating a new class, you can toggle the templates "class", "interface", and "trait" by using your up and down keys. Pretty neat and fast! 💨


#31
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #31 - No Mouse Commit

When you commit/push with PhpStorm tools, you can press the "Alt" key to show letters to trigger the "commit" or "push" button.

This means no mouse is needed for the whole process. 😍


#30
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #30 - Key Promoter X

Sometimes we fall into a habit of using the mouse for something, where we could have used a shortcut.

Key Promoter X is a plugin that tells of such situations. It reminds you by showing the shortcut you should use instead.


#29
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #29 - Run Tests

Another cool feature using the "Run Anything" prompt and custom "Run configurations" to run specific tests like unit, feature, or all.
br /> Especially being able to run "all test" is something I missed an easy solution for a long time. 😍


#28
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #28 - Run Tasks

We often tend to run tasks from within the Terminal. That's fine, but what I prefer is to run them through "Run Anything".

This way I don't have to open up the Terminal and I have one place to check my running tasks.


#27
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #27 - Toggle Search Scope

I hope you already know your shortcuts for specific searches. ( files, classes, etc.)

One little trick here is if you press the shortcut again it toggles the scope of the search between "Project Files" and "All Files" Left-pointing magnifying glass


#26
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #26 - Changelist

In a repository, all changes will the stored to the "Default Changelist" in PhpStorm.

When you edit more files than needed for the next commit, it makes sense to order them in custom changelist.


#25
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #25 - Run Anything

The "Run Anything" prompt can be used to quickly run tasks like from npm/Yarn, but did you know that you can run Artisan calls too? 🤩

Pretty handy for triggering a command without opening the terminal.


#24
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #24 - Toggle Plugins

I need to activate/deactivate some PhpStorm plugins more often. Gladly I can do that also through the global search.

Be aware, some plugins require a restart.


#23
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #23 - Presentation Assistant

The Presentation Assistant is great to show the shortcuts you are using while talks or presentations.

By default it includes the default keys. But you can change that to show the ones you have actually set 👍


#22
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #22 - Tailwind CSS

If you work with #TailwindCSS, make sure to use the latest 2020.3 version of PhpStorm to support auto-completion and preview of the rules on mouse-over.


#21
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #21 - Open in split mode

With PhpStorm 2020.3 you are able to open files directly in split mode. The shortcut works from within the sidebar, but also from the other windows like "recent files" which I really love.

PS: default shortcut is "shift+enter"


#20
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #20 - Find Actions

Actions are commands + shortcuts in PhpStorm. With the action search, you can easily trigger features without knowing shortcuts.

💡Even better: If you use an action a lot, just assign a shortcut right from the search with alt+enter.


#19
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #19 - Go To Test Shortcut

This tip I received by @SenseException. There is a shortcut for getting from a class to its test if given or create a new one.


#18
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #18 - Initialize Properties

Constructor arguments can be initialized by PhpStorm. Here are some interesting facts:

1. You can initialize multiple fields
2. PHP < 7.4 it uses PHP DocBlocks
3. You can edit the template
4. >= 7.4 it skips the DocBlock ❤️


#17
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #17 - Change List

Ever wondered about this little colored mark on a line? It shows your changes since the last commit.

Use it too look at what changed or to rollback a change 👍


#16
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #16 - File Colors

This one is actually a tip by @brendt_gd . You can use scopes in combination with file colors to create highlighted sections in your project's tree view.

It improves file recognition and also works with tabs 🏳️‍🌈


#15
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #15 - Multi Cursors (2)

I got some feedback about more ways to use multiple cursors in PhpStorm, so here are two more:

- add carets to the end of selected lines
- clone caret alt+alt 🔼/🔽


#14
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #14 - Productivity Guide

The Productivity Guide shows you an overview of your PhpStorm features usage. It tells you about what you use regularly and what you never used before.

It's also great to learn about new features.


#13
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #13 - File Structure Tool

When you're checking a longer class, the "File Structure" tool window becomes super handy. It...

👀 gives an overview of given properties/methods
🔎 lets you search for sthg specific
🔎 even lets you search params names


#12
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #12 - If / Else Transformations

There are numerous things you can do with if/else statements in PhpStorm like:

- flip condition
- simplify them
- get rid of "else" (EA Inspections plugin)


#11
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #11 - Multi Cursor

Multi-cursors are so powerful and a must-have in every code editor.

Here are three ways of using them in PhpStorm:

1⃣ Atl + click
2⃣ Alt + shift + hold click + move up/down
3⃣ Multiple select


#10
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #10 - Postfix Templates

Next to "Live Templates" there are also "Postfix Templates" which you can trigger by putting a "." after an expression and then add a key.

This way you don't have to replace the cursor if you wrote the expression first.

".dd" is a custom one 😈


#9
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #9 - Best Way To Explore Code

I use the "Go to declaration" shortcut all the time to check a class/method that was used. This was essential for learning how Laravel works under the hood.

But the same shortcut can also be used on the declaration to see where else it is used. 🔎


#8
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #8 - Hide Active Tool Window

There are shortcuts for all tool windows like the sidebar, console, etc. The same close it again.

What I find more useful though is to use the "hide active tool window" shortcut. This way you don't have to think about which toolbar it is anymore.


#7
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #7 - Best Way To Run Tests

To run a specific test depending on your cursor position, use the "Run context configuration" shortcut.

- Inside a method ➡️ run this test method
- Between methods ➡️ run whole file

The same shortcut used in all three examples in the video.


#6
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #6 - Surround With And Emmet

Last time I showed you the "Surround With" feature, but there is more to it. @pronskiy gave me a hint that we can use it together with Emmet. 😍

Now, this gets even more powerful.


#5
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #5 - Surround Selection With

When I needed a tag around some given text, I always created the tag first, then put the text in. I got used to this tedious behavior 🙈

Recently I discovered the "Surround With" feature. 😮

Such details make so much difference in your workflow!


#4
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #4 - Convert To Arrow Functions

You can easily convert functions to arrow functions by using the "show context action" (⌥ + enter) shortcut.

My favorite aspect is that you do not need "use" anymore to pass variables to the function. Less code is good code 👌


#3
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #3 - Style Through Global Search

You can style many parts of your IDE within the global search without visiting the settings page like the:

- 💡status bar
- 🍞 breadcrumbs
- 🗂tabs placement
- 🧭 navigation bar
- etc.


#2
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #2 - Composer Auto-complete

Version 2020.1 brought some cool new Composer features like showing the exact used version of a package in the composer.json file.

But did you also know that it autocompletes new requirements now? 😍


#1
photo of Christoph Rumpel

Christoph Rumpel 🤠

@christophrumpel

🧪 PhpStorm Tips & Tricks #1 - Live Templates

Here is one of my favorite ones to create a simple new test exactly how I like them. Customize everything to your needs.🕺

What templates did you create?


You made it till the end 👏
I'm sure you're ready for more!

Mastering PhpStorm Logo text

Tips & Tricks was just the beginning. In my new video course, I cover all the essential features of PhpStorm like Refactoring, Testing, Debugging, Git in detail.

Show Me