PHPackages                             mix/http-server - 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. mix/http-server

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

mix/http-server
===============

Http server library based on Swoole coroutine, following PSR-7 / PSR-15 standard

v3.0.27(5y ago)06.7k19Apache-2.0PHPPHP &gt;=7.0.0CI failing

Since Mar 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mix-php/http-server)[ Packagist](https://packagist.org/packages/mix/http-server)[ Docs](https://openmix.org/)[ RSS](/packages/mix-http-server/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (6)Versions (24)Used By (9)

Mix Http Server
---------------

[](#mix-http-server)

基于 Swoole 协程的 http server 类库，遵循 PSR-7 / PSR-15 标准

Usage
-----

[](#usage)

安装：

- Swoole &gt;= 4.4.4:

```
composer require mix/http-server

```

服务器：

- 使用 `handle` 配置

> '/' 将匹配所有路由

```
$server = new Mix\Http\Server\Server('0.0.0.0', 9596, false, false);
$server->handle('/', function (\Mix\Http\Message\ServerRequest $request, \Mix\Http\Message\Response $response) {
    $response->withBody(new \Mix\Http\Message\Stream\ContentStream('hello, world!'));
    $response->send();
});
$server->start();

```

- 实现 `HandlerInterface` 接口

```
class Router implements \Mix\Http\Server\ServerHandlerInterface
{
    public function handleHTTP(ServerRequest $request, Response $response) {
        // ...
    }
}

$handler = new Router();

$server = new Mix\Http\Server\Server('0.0.0.0', 9596, false, false);
$server->start($handler);

```

中间件：

```
$process    = function (ServerRequest $request, Response $response) use ($result) {
    // ...
    return $response;
};
$dispatcher  = new MiddlewareDispatcher($middleware, $process, $request, $response);
$response    = $dispatcher->dispatch();

```

License
-------

[](#license)

Apache License Version 2.0,

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~34 days

Recently: every ~81 days

Total

23

Last Release

1859d ago

Major Versions

v2.2.17 → v3.0.272021-04-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16074765?v=4)[LIU JIAN](/maintainers/onanying)[@onanying](https://github.com/onanying)

---

Top Contributors

[![onanying](https://avatars.githubusercontent.com/u/16074765?v=4)](https://github.com/onanying "onanying (39 commits)")

---

Tags

httpmixserverhttpserverswoolecoroutinemix

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mix-http-server/health.svg)

```
[![Health](https://phpackages.com/badges/mix-http-server/health.svg)](https://phpackages.com/packages/mix-http-server)
```

###  Alternatives

[hhxsv5/laravel-s

🚀 LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

3.9k676.0k10](/packages/hhxsv5-laravel-s)[swow/swow

Coroutine-based multi-platform support engine with a focus on concurrent I/O

1.3k2.1M84](/packages/swow-swow)[swlib/saber

Swoole coroutine HTTP client

985145.0k27](/packages/swlib-saber)[swoole-bundle/swoole-bundle

Open/Swoole Symfony Bundle

6650.4k](/packages/swoole-bundle-swoole-bundle)[swoole/etcd-client

Grpc PHP Client base on Swoole Http2 Coroutine

1973.2k1](/packages/swoole-etcd-client)[leocavalcante/request-callback

Swoole request callback for PSR compliant handlers.

261.2k1](/packages/leocavalcante-request-callback)

PHPackages © 2026

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