Download the PHP package philiprehberger/php-stopwatch without Composer

On this page you can find all versions of the php package philiprehberger/php-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 php-stopwatch

PHP Stopwatch

Tests Latest Version on Packagist Last updated

Precise code execution timer with lap tracking and memory measurement.

Requirements

Installation

Usage

Quick measurement

Measurement with return value

Manual start/stop with laps

Check elapsed time while running

Pause and resume

Nested stopwatches

Benchmark comparisons

Threshold alerts

Comparison reports

Profiling decorator

Statistical analysis

API

Method Returns Description
Stopwatch::start(?string $name) RunningStopwatch Start a new stopwatch with an optional name
Stopwatch::measure(callable $fn) MeasureResult Measure execution time and memory of a callable
Stopwatch::measureWithResult(callable $fn) array{result, measure} Measure while preserving the return value
Stopwatch::benchmark(array $callables, int $iterations) BenchmarkResult Run each callable N times and compare performance
Stopwatch::measureWithThreshold(callable, float, callable) MeasureResult Measure and fire callback if threshold exceeded
Stopwatch::compare(array $benchmarks, int $iterations) ComparisonReport Compare named callables with rankings and ASCII table
Stopwatch::profile(object $target) ProfilingProxy Create a profiling proxy for automatic method timing
Stopwatch::getProfile(ProfilingProxy $proxy) array<string, StopwatchStats> Get profiling data from a proxy
RunningStopwatch->onThreshold(float $ms, callable) self Register threshold callback fired on stop()
RunningStopwatch->lap(?string $name) self Record a lap with an optional name
RunningStopwatch->child(string $name) RunningStopwatch Create a nested child stopwatch
RunningStopwatch->stop() StopwatchResult Stop the timer and return results
RunningStopwatch->pause() void Pause timing without stopping the stopwatch
RunningStopwatch->resume() void Resume timing after a pause
RunningStopwatch->getElapsedSoFar() float Get elapsed seconds without stopping
RunningStopwatch->elapsed() float Get elapsed milliseconds while still running
RunningStopwatch->isRunning() bool Check if the stopwatch is still active
RunningStopwatch->isPaused() bool Check if the stopwatch is currently paused
StopwatchResult->report() string Generate a formatted report with all laps
StopwatchResult->children() array<StopwatchResult> Get child stopwatch results
StopwatchResult->stats() StopwatchStats Get statistical analysis of lap durations

Value Objects

StopwatchResultduration (float, ms), durationFormatted (string), memory (int, bytes), memoryFormatted (string), peakMemory (int, bytes), laps (array), name (?string), children (array)

MeasureResultduration (float, ms), durationFormatted (string), memory (int, bytes), memoryFormatted (string)

Lapname (?string), duration (float, ms), cumulativeDuration (float, ms)

BenchmarkResultresults() (array of BenchmarkEntry), report() (string)

BenchmarkEntrymean (float, ms), median (float, ms), min (float, ms), max (float, ms), iterations (int)

StopwatchStatsmean(), median(), min(), max(), p95(), p99(), standardDeviation() (all float, ms)

ComparisonReporttoTable() (string), fastest() (BenchmarkEntry), slowest() (BenchmarkEntry), rankings() (array), toArray() (array)

ThresholdMonitoraddThreshold(float $ms, callable) (self), check(StopwatchResult|MeasureResult) (void)

ProfilingProxygetProfile() (array of StopwatchStats), getTarget() (object), getRawProfile() (array)

Development

Support

If you find this project useful:

Star the repo

🐛 Report issues

💡 Suggest features

❤️ Sponsor development

🌐 All Open Source Projects

💻 GitHub Profile

🔗 LinkedIn Profile

License

MIT


All versions of php-stopwatch with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 philiprehberger/php-stopwatch contains the following files

Loading the files please wait ...