https://github.com/jmervine/php-httperf
Simple PHP Port of HTTPerf.rb [https://github.com/jmervine/httperfrb]
https://github.com/jmervine/php-httperf
Last synced: about 1 year ago
JSON representation
Simple PHP Port of HTTPerf.rb [https://github.com/jmervine/httperfrb]
- Host: GitHub
- URL: https://github.com/jmervine/php-httperf
- Owner: jmervine
- License: mit
- Created: 2014-04-21T18:20:26.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-28T18:46:47.000Z (almost 12 years ago)
- Last Synced: 2025-02-01T16:12:51.674Z (about 1 year ago)
- Language: PHP
- Size: 203 KB
- Stars: 5
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wpo - PHP-httperf - PHP Port of HTTPerf.rb. (Web server Benchmarks / Meetups)
- fucking-awesome-wpo - PHP-httperf - PHP Port of HTTPerf.rb. (Web server Benchmarks / Meetups)
- awesome-wpo-chinese - PHP-httperf - PHP Port of HTTPerf.rb. (Webserver Benchmarks)
- awesome-wpo-dup - PHP-httperf - PHP Port of HTTPerf.rb. (Webserver Benchmarks)
README
HTTPerf.php [](https://travis-ci.org/jmervine/php-httperf)
-----------
##### Simple PHP port of [HTTPerf.rb](https://github.com/jmervine/httperfrb)
> Should be condiered in development, or beta. Pull requests welcome, see [dev notes](#development) below.
Simple PHP interface for [httperf](http://mervine.net/httperf).
Tested via [Travis-CI](https://travis-ci.org/jmervine/php-httperf) on:
* PHP 5.3
* PHP 5.4
* PHP 5.5
* HHVM
## Installing 'httperf'
Requires [httperf](http://mervine.net/httperf), of course...
#### Mac
sudo port install httperf
#### Debian / Ubuntu
sudo apt-get install httperf
#### Redhat / CentOS
sudo yum install httperf
#### My 'httperf'
See: [httperf-0.9.1 with individual connection times](http://mervine.net/httperf-0-9-1-with-individual-connection-times).
## Basic Usage
``` php
"www.example.com",
"uri" => "/foo/bar",
"rate" => 10,
"num-conns" => 1000,
"verbose" => true,
"hog" => true,
"parse" => true
);
$httperf = new HTTPerf($options);
$results = $httperf->run();
print_r($results);
$httperf->updateOptions("uri", "www.google.com");
$results = $httperf->run();
print_r($results);
```
#### Forking
``` php
"www.example.com",
"rate" => 5,
"num-conns" => 10,
"parse" => true,
"verbose" => true
));
echo "Running: ";
echo $httperf->command() . "\n";
/**
* Example 1 - Fork and wait.
******************************************/
$proc = $httperf->fork();
print_r($httperf->forkWait(1, function() {
echo "forkWait: waiting...\n";
}));
echo "----\n";
echo "Running: ";
echo $httperf->command() . "\n";
/**
* Example 1 - Fork check if running.
******************************************/
$proc = $httperf->fork();
while ($httperf->forkRunning()) {
echo "fork running...\n";
sleep(1);
}
print_r($httperf->result);
```
## Development
Please feel free to submit pull requests as this is my first stab at PHP in about 10 years. Before submitting a pull request, though, please make sure to update (if necessary) and run unit tests.
```
make test
```