phpbench/phpbench
PHP Benchmarking Framework
Maintainers
Fund package maintenance!
Requires
- php: ^8.2
- ext-dom: *
- ext-json: *
- ext-pcre: *
- ext-reflection: *
- ext-spl: *
- ext-tokenizer: *
- doctrine/annotations: ^2.0
- phpbench/container: ^2.2
- psr/log: ^1.1 || ^2.0 || ^3.0
- seld/jsonlint: ^1.1
- symfony/console: ^6.1 || ^7.0 || ^8.0
- symfony/filesystem: ^6.1 || ^7.0 || ^8.0
- symfony/finder: ^6.1 || ^7.0 || ^8.0
- symfony/options-resolver: ^6.1 || ^7.0 || ^8.0
- symfony/process: ^6.1 || ^7.0 || ^8.0
- webmozart/glob: ^4.6
Requires (Dev)
- dantleech/invoke: ^2.0
- ergebnis/composer-normalize: ^2.39
- jangregor/phpstan-prophecy: ^2.0
- php-cs-fixer/shim: ^3.9
- phpspec/prophecy: ^1.22
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^11.5
- rector/rector: ^2.2
- sebastian/exporter: ^6.3.2
- symfony/error-handler: ^6.1 || ^7.0 || ^8.0
- symfony/var-dumper: ^6.1 || ^7.0 || ^8.0
Suggests
- ext-xdebug: For Xdebug profiling extension.
Provides
None
Conflicts
None
Replaces
None
MIT 3d13c0d5dcf8730a67b70fa7fb03b4556b5cc0fe
- Daniel Leech <daniel.woop@dantleech.com>
This package is auto-updated.
Last update: 2026-06-14 18:28:33 UTC
README
👁 StandWithUkraine
👁 CI
👁 Documentation
👁 Latest Stable Version
👁 Total Downloads
👁 License
PHPBench is a benchmark runner for PHP analogous to PHPUnit but for performance rather than correctness.
Features include:
- Revolutions: Repeat your code many times to determine average execution time.
- Iterations: Sample your revolutions many times and review aggregated statistical data.
- Process Isolation: Each iteration is executed in a separate process.
- Reporting: Customizable reports and various output formats (e.g. console, CSV, Markdown, HTML).
- Report storage and comparison: Store benchmarks locally to be used as a baseline reference, or to reference them later.
- Memory Usage: Keep an eye on the amount of memory used by benchmarking subjects.
- Assertions: Assert that code is performing within acceptable limits, or that it has not regressed from a previously recorded baseline.
See the documentation to find out more.
Installation
composer require phpbench/phpbench --dev
See the installation instructions for more options.
Documentation
Documentation is hosted on readthedocs.
Community
- Follow @phpbench on Mastodon for the latest news.
- Join the
#phpbenchchannel on the Slack Symfony Devs channel.
Screenshots
Running benchmarks and comparing against a baseline:
Aggregated report:
Blinken logger:
HTML Bar Chart:
Console Bar Chart:
Contributing
PHPBench is an open source project. If you find a problem or want to discuss new features or improvements please create an issue, and/or if possible create a pull request.
