PHPackages                             firstphp/wsdebug - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. firstphp/wsdebug

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

firstphp/wsdebug
================

wsdebug for hyperf

1.1.7(4y ago)35902↓80%6MITHTMLPHP &gt;=7.2

Since Nov 6Pushed 4y ago2 watchersCompare

[ Source](https://github.com/lamplife/wsdebug)[ Packagist](https://packagist.org/packages/firstphp/wsdebug)[ RSS](/packages/firstphp-wsdebug/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)DependenciesVersions (11)Used By (0)

Wsdebug
=======

[](#wsdebug)

> Wsdebug for Hyperf

安装组件:
-----

[](#安装组件)

> composer require firstphp/wsdebug

安装 WebSocket 服务:
----------------

[](#安装-websocket-服务)

> [详见 Hyperf 官方文档](https://doc.hyperf.io/#/zh/websocket-server)

发布配置:
-----

[](#发布配置)

> php bin/hyperf.php vendor:publish firstphp/wsdebug

注意事项：
-----

[](#注意事项)

- 配置文件路径：/web/hyperf/config/autoload/wsdebug.php
- 默认地址是 ws://127.0.0.1:9505 ，需修改成服务实际配置地址

使用方法：
-----

[](#使用方法)

> 1.通过自定义路由 Router 添加输出页面

编辑路由文件 /hyperf/config/routes.php ，添加如下内容：

```
Router::addRoute(['GET', 'POST', 'HEAD'], '/wsdebug', function() {
    $wsdebug = new \Firstphp\Wsdebug\Wsdebug();
    $response = new \Hyperf\HttpServer\Response();
    return $response->raw($wsdebug->getHtml())->withHeader('content-type', 'text/html; charset=utf-8');
});

Router::addServer('ws', function () {
    Router::get('/', Firstphp\Wsdebug\Wsdebug::class);
});
```

> 2.Hyperf Demo

```
