PHPackages                             byphper/stress - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. byphper/stress

ActiveLibrary[Testing &amp; Quality](/categories/testing)

byphper/stress
==============

Multi-process stress testing tool based on swoole

222PHP

Since Jul 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/byphper/stress)[ Packagist](https://packagist.org/packages/byphper/stress)[ RSS](/packages/byphper-stress/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

基于swoole多进程多协程的http压力测试工具
=========================

[](#基于swoole多进程多协程的http压力测试工具)

灵感来自于go夜读的一次分享，如何用go实现压力测试工具，代码在[https://github.com/link1st/go-stress-testing。](https://github.com/link1st/go-stress-testing%E3%80%82)go原生的协程可以很方便的实现并发请求，Swoole4+以后对协程做了大量的工作，包括提供了各种协程客户端，所以试着用swoole来实现一个类似的压测工具。得力于swoole对底层进程，协程，以及它们之间通信的高度封装，我们实现这个小工具只需要很少的代码。

### 安装

[](#安装)

```
composer require byphper/stress

```

### 使用

[](#使用)

目前只支持HTTP压测

```

vendor/bin/stress http -c 10 -r 100 -u http://www.xxx.com/

```

#### 参数说明

[](#参数说明)

- -c concurrency 并发数
- -r request 请求数
- -u url 请求地址 一定要是完整的URL格式 不能省略http://
- -m method 请求方法 默认GET
- -k keep-alive 是否开启http keep-alive 默认false不开启
- -H http-header 设置请求头 以json字符串格式 eg：-H '{"access\_token":"xxxxxx"}'
- -C http-cookie 设置cookie 以json字符串格式 eg：-C '{"seesion\_id":"xxxxxx"}'
- -B http-body 设置请求body 以json字符串格式 eg：-B '{"name":"xxxxxx"}'

#### 输出示例

[](#输出示例)

```
本次派出2个进程,共2个协程对接口进行疯狂轰炸!!!

请求地址：http://127.0.0.1:9501/

并发数：2

请求数：10

请求cookie：{"seesion_id":"abcdefg"}

请求body：{"name":"andy"}

+-------+--------+--------+--------+-------+----------+
| 耗时  | 并发数 | 成功数 | 失败数 | QPS   | 平均耗时 |
+-------+--------+--------+--------+-------+----------+
+-------+-------+-------+-------+-----------+----------+
| 0     | 2     | 20    | 0     | 740.74/秒 | 0.0013秒 |
+-------+-------+-------+-------+-----------+----------+

战况：共派出2个协程，发起总请求数：20，成功请求数：20,失败请求：0，QPS：740.74/秒，平均耗时：0.0013秒

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/42dd2594cd051a13fb08f22b8a3d20bfc303fce305a134977d9ff571ff3c32f6?d=identicon)[byphper](/maintainers/byphper)

---

Top Contributors

[![byphper](https://avatars.githubusercontent.com/u/3981867?v=4)](https://github.com/byphper "byphper (2 commits)")

### Embed Badge

![Health badge](/badges/byphper-stress/health.svg)

```
[![Health](https://phpackages.com/badges/byphper-stress/health.svg)](https://phpackages.com/packages/byphper-stress)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
