PHPackages                             quillstack/benchmark - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. quillstack/benchmark

ActiveLibrary[HTTP &amp; Networking](/categories/http)

quillstack/benchmark
====================

Bash/PHP script to benchmark HTTP requests and command line scripts.

1.0.7(5y ago)118MITPHPPHP ^7.4

Since Aug 30Pushed 4y ago1 watchersCompare

[ Source](https://github.com/quillstack/benchmark)[ Packagist](https://packagist.org/packages/quillstack/benchmark)[ Docs](https://quillstack.com/benchmark)[ RSS](/packages/quillstack-benchmark/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (0)

Benchmark HTTP requests and command line calls
==============================================

[](#benchmark-http-requests-and-command-line-calls)

[![StyleCI](https://camo.githubusercontent.com/c058e3a74c85629b453537dfa75c08232630e168d377c8473f024ba3a691d769/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3239313439343138322f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/291494182?branch=master)[![Build Status](https://camo.githubusercontent.com/94c047c216d17aa5ce1df1fff6ab541be33b71b10d3ac79bee121583fa721eb0/68747470733a2f2f7472617669732d63692e6f72672f7175696c6c737461636b2f62656e63686d61726b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/quillstack/benchmark)[![CodeFactor](https://camo.githubusercontent.com/7a037d5bb4929dd0b21eb671c5e0eb7b2f651b3c257264ce8475096dcf6a1235/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f7175696c6c737461636b2f62656e63686d61726b2f6261646765)](https://www.codefactor.io/repository/github/quillstack/benchmark)[![Downloads](https://camo.githubusercontent.com/90c34b50547930e8969ad6aea24a30f213703ef316c0717dac9e176374152939/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7175696c6c737461636b2f62656e63686d61726b2e737667)](https://packagist.org/packages/quillstack/benchmark)[![Packagist PHP Version Support](https://camo.githubusercontent.com/4c315b606b40804e68da01809f22fd929a03f3c1196b13c19ebde4f6db9281cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7175696c6c737461636b2f6469)](https://camo.githubusercontent.com/4c315b606b40804e68da01809f22fd929a03f3c1196b13c19ebde4f6db9281cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7175696c6c737461636b2f6469)[![Packagist License](https://camo.githubusercontent.com/f7f8b5677eccd3397c24adae2cd2bd6526081862d4b7fc0e360e098a31df6d7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7175696c6c737461636b2f6469)](https://camo.githubusercontent.com/f7f8b5677eccd3397c24adae2cd2bd6526081862d4b7fc0e360e098a31df6d7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7175696c6c737461636b2f6469)

This repository contains a script to test HTTP GET requests or command line calls.

PHP usage
---------

[](#php-usage)

You can install this package using *Composer*:

```
composer require --dev quillstack/benchmark

```

In PHP console you can use this library by running commands:

##### List available commands

[](#list-available-commands)

If you installed this library as a package in your project, you can run these commands:

###### List of available commands

[](#list-of-available-commands)

```
./vendor/bin/benchmark

```

###### HTTP GET requests

[](#http-get-requests)

```
./vendor/bin/benchmark benchmark:http:get https://example.org 10 2

```

###### Command line calls

[](#command-line-calls)

```
./vendor/bin/benchmark benchmark:console "php ../test.php" 10 2

```

#### Cloned reposotiry

[](#cloned-reposotiry)

If you cloned this repository to your local computer, use these commands:

```
./bin/local
./bin/local benchmark:http:get https://example.org 10 2
./bin/local benchmark:console "php ../test.php" 10 2

```

To see detailed descriptions for every command, ready Bash usage below.

Bash usage
----------

[](#bash-usage)

You can also use Bash commands to run benchmarks. These commands work only if you clone this repository to your computer or server.

###### HTTP GET requests

[](#http-get-requests-1)

Usage:

```
./http_get.sh https://example.org 10 2

```

Where:

- 10 is a total number of requests
- 2 is a number of concurrent requests

Output:

```
10 requests, 2 concurrently
URL https://example.org
--------------------------------------------------------------------
Took 2.468000 s, 4.051864 requests per second, 0.469415 avg req time

```

What means we sent 10 GET requests to this host. We decided to send two requests at the time. The entire test took around 2.5 seconds. It means the website could server 4 requests per second with 0.5 seconds the average response time.

###### Command line calls

[](#command-line-calls-1)

If you want to test command line calls, be sure every call respond with an execution time (in seconds):

```
0.001699

```

For PHP the script could look like:

```
