Download the PHP package teqneers/phpunit-stopwatch without Composer

On this page you can find all versions of the php package teqneers/phpunit-stopwatch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpunit-stopwatch

phpunit-stopwatch

Latest Stable Version CI

Scrutinizer Code Quality Code Coverage Code Climate codecov Type Coverage

Project information: License

Stopwatch is an essential phpunit/phpunit extension for performance analysis!

Gain invaluable insights into your code's execution time and call frequency during test runs. The extension is designed to elevate your code performance analysis. Track the execution time and frequency of any marked code segments to address performance bottlenecks with precision. You can identify performance bottlenecks (e.g., database cleanups or setup) or just monitor them over time. The extension will generate stopwatch reports for each test as well as a summary report at the end of the test run.

This project provides a composer package and a Phar archive.

The extension is compatible with the following versions of phpunit/phpunit:

Once you've added some measurement points to your code, the extension will stop watch and count them. The results are displayed for each test and as a total report at the end of the test run.

Here is an example of how the output of a single test class might look:

And at the end of the test run, you will get a summary of all stopwatches used, and it is going to look like this:

Usage

Stopwatch is very easy to use. A single line of code wrapped around the code you want to measure is all it takes.

For instance, let's say your tests are pretty slow, but you don't know who's the culprit? You suspect that it might be the database setup that has to be done for each and every test. Simply wrap the suspected code block as follows:

Should the test, setup, teardown, or other relevant methods execute this code, Stopwatch will seamlessly measure its execution time and count, and will present the results within the test output.

Installation

Installation with composer

Run

to install teqneers/phpunit-stopwatch as a composer package.

Installation as Phar

Download phpunit-stopwatch.phar from the latest release.

Usage

Bootstrapping the extension

Before the extension can detect slow tests in phpunit/phpunit, you need to bootstrap it. The bootstrapping mechanism depends on the version of phpunit/phpunit you are using.

Bootstrapping the extension as a composer package

To bootstrap the extension as a composer package when using

adjust your phpunit.xml configuration file and configure the

Bootstrapping the extension as a PHAR

To bootstrap the extension as a PHAR when using

adjust your phpunit.xml configuration file and configure the

Configuring the extension

So far, there are no configuration settings for this extension.

Running tests

When you have bootstrapped the extension, you can run your tests as usually. E.g.:

When the extension is used somewhere in your code, it will give you a report:

License

This project uses the MIT license.

Credits

This package is inspired by ergebnis/phpunit-slow-test-detector.


All versions of phpunit-stopwatch with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
phpunit/phpunit Version ^10.1.0 || ^11.0.0
psr/clock Version ^1.0.0
symfony/clock Version ^6.4.0 || ^7.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package teqneers/phpunit-stopwatch contains the following files

Loading the files please wait ....