PHPSpy is James Bond’s favorite tool for PHP7, inspired by the Ruby sampling profiler rbspy. It provides low-overhead sampling profiler for PHP 7, however actually only working with Linux x86_64 non-ZTS PHP 7 with CLI and Apache SAPIs. PHPSpy came with a top-like tool that show how PHP functions are called internally, you can even peek at variables at runtime.

PHPSpy in action

You can also use it make flamegraphs like this:

PHPSpy

All this could be done with no changes to your application and minimal overhead. To install it simply clone the repository and run make to build it, then you can run ./phpspy -h for full list of commands.

LEAVE A REPLY

Please enter your comment!
Please enter your name here