If you enjoy reading my blog, you could consider supporting me on Patreon.

Scopes in PHPStorm

Scopes in PHPStorm can significantly improve your development experience. They enable better search and allow for custom file colours.

For example, this is what I'm talking about:

A tree view configured with coloured scopesA tree view configured with coloured scopes

These colours allow you to easily recognise files, and that in turn allows you to think more freely about things that really matter when coding.

First you'll want to configure one or more scopes. A scope is a set of textual filters that are applied on your files.

Configuring scopes 1Configuring scopes 1

You can use the buttons to include and exclude folders and files, or you can write the filters yourself. There's a special syntax, described here.

Don't forget you can expand the text area for easier configuration.

Configuring scopes 2Configuring scopes 2

# File colours

Every scope can be applied a specific colour. This makes it easy to easily spot files.

File coloursFile colours

By applying colours to a scope, you'll see them in the tree view, in file tabs and when using file navigation.

File coloursFile colours

# Filtering by scope

Besides colours, scopes also allow for easy filtering. For example, in the tree view.

File coloursFile colours

But also in the finder.

File coloursFile colours

# Defaults

Setting up scopes shouldn't take longer than 10 minutes every project, and saves a lot of time in the long run.

PHPStorm also offers a default settings option though, which will be used every every time you create a new project. Go to File > Default Settings and configure your default scopes and colours over there.

Would you like to stay up to date about new content? Feel free to subscribe to my newsletter and follow me on Twitter. Noticed a tpyo? You can submit a PR to fix it.