Stackwatch is a lightweight profiler for PHP 8.1+. It helps you measure performance with precision—without unnecessary complexity.
Stackwatch bridges the gap between basic timers and heavy profiling tools like PHPBench, Xdebug or Blackfire. It is perfect for:
- Isolated performance testing
- Annotated profiling of large codebases
- Lightweight integration into dev workflows
Zero-dependency core. Optional CLI with familiar Symfony Console integration.
composer require bakame/stackwatch
You need:
- PHP >= 8.1 but the latest stable version of PHP is recommended
- the
psr/log
package or any package implementing the PHP-FIG log contract
To use the CLI command you will also need:
symfony/console
andsymfony/process
Full documentation can be found at https://bakame-php.github.io/stackwatch/
The library has:
- a PHPUnit test suite.
- a coding style compliance test suite using PHP CS Fixer.
- a code analysis compliance test suite using PHPStan.
To run the tests, run the following command from the project folder.
composer test
Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CHANGELOG for more information on what has changed recently.