kaspi / benchmark
Simple benchmarking library
Requires
- php: 8.1 - 8.5
- ext-reflection: *
Requires (Dev)
- friendsofphp/php-cs-fixer: 3.95.21
- mikey179/vfsstream: 1.6.12
- phpstan/phpstan: 2.2.9
- phpstan/phpstan-strict-rules: 2.0.12
- phpunit/phpunit: 10.5.64
This package is auto-updated.
Last update: 2026-08-24 05:25:53 UTC
README
Install
composer require kaspi/benchmark
How to use
Tests
Running tests without code coverage analysis:
composer test
Running tests with code coverage analysis:
composer test-cover
Static code analysis
We use the PHPStan package for static analysis:
composer stat
Code style
To bring the code into compliance with standards, we use friendsofphp/php-cs-fixer, which is declared in the composer dev dependency:
composer fixer
Using a Docker image with PHP 8.1, 8.2, 8.3, 8.4, 8.5
You can specify the PHP version image in the .env file using the PHP_IMAGE key.
By default, the container is built using the php:8.1-cli-alpine image.
Building docker container
docker-compose build
Install dependencies via composer:
docker-compose run --rm php composer install
🔔 If make is installed on the system:
make install
Tests
Running tests without code coverage analysis:
docker-compose run --rm php vendor/bin/phpunit --no-coverage
🔔 If make is installed on the system:
make test
Running tests with code coverage analysis:
docker-compose run --rm php vendor/bin/phpunit
🔔 If make is installed on the system:
make test-cover
⛑ The results will be in the
.coverage-htmlfolder.
Static code analysis
docker-compose run --rm php vendor/bin/phpstan
🔔 If make is installed on the system:
make stat
All checks in a single command
If make is installed, run the code-style check, static analyzer, and tests:
make all
Running tests for all supported PHP versions using Docker images.
If make is installed, the vendor directory and composer.lock file are removed before running the tests;
dependencies are installed, and only then are the tests executed:
make test-supports-php
Other
You can work in the shell within a Docker container:
docker-compose run --rm php sh