Blackfire stubs in PHPStorm 2020.1

By Jérôme Vieilledent, on Jun 02, 2020

Blackfire supports PHP via a C extension. That extension exposes a \BlackfireProbe class that implements all the low-level profiling methods. This class is what the blackfire/php-sdk library uses for low level operations.

But did you know that you can directly use the \BlackfireProbe class as well? In fact, it does not require to install nor master the SDK, and it covers the most common use cases such as:

With the 2020.1 release a few weeks ago, PHPStorm now provides full code completion on the internal \BlackfireProbe class, which makes the developer experience a lot smoother.

Furthermore, most of the methods exposed by \BlackfireProbe stay inert, unless a profile is being requested. Putting it another way, you can add as many timeline markers as you want, and/or instrument specific parts of your application without overhead! At least, PHPStorm now knows about it 😊.

To make sure you get code completion, check that blackfire extension is enabled in PHPStorm settings (Languages & Frameworks / PHP / PHP Runtime):

Oh, and one more thing ! VisualStudio Code uses PHPStorm stubs for its own code completion. This means that if you are a VS Code user, enjoy as well!

Happy profiling!

Jérôme Vieilledent

As a Developer Advocate, Jérôme is all about spreading the love! His technical/development background enable him to talk as a peer to peers with our developer users. You’ll read his tips and advices on performance management with Blackfire. And he’ll support you as a day-to-day user.