bakame / stackwatch
A minimalist, embeddable, multi-metric, and framework-agnostic profiler for PHP
Fund package maintenance!
nyamsprod
Requires
- php: ^8.1
- psr/log: ^3.0.2
- symfony/console: ^6.4 || ^7.3.2
- symfony/process: ^6.4 || ^7.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.85.1
- monolog/monolog: ^3.9
- nyholm/psr7: ^1.8.2
- open-telemetry/exporter-otlp: ^1.3.2
- phpstan/phpstan: ^2.1.21
- phpstan/phpstan-deprecation-rules: ^2.0.3
- phpstan/phpstan-phpunit: ^2.0.7
- phpstan/phpstan-strict-rules: ^2.0.6
- phpunit/phpunit: ^10.5.15 || ^11.5.25 || ^12.2.9
- symfony/http-client: ^v6.4.19 || ^7.3.2
- symfony/var-dumper: ^6.4.21 || ^7.3.2
Suggests
- open-telemetry/exporter-otlp: to export the profiler results to an opentelemetry compatible server
README
Stackwatch
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.
Installation
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
Documentation
Full documentation can be found at https://bakame-php.github.io/stackwatch/
Testing
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
Contributing
Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email nyamsprod@gmail.com instead of using the issue tracker.
Changelog
Please see CHANGELOG for more information on what has changed recently.