定制 khepin/rr-dumpserver 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

khepin/rr-dumpserver

Composer 安装命令:

composer require khepin/rr-dumpserver

包简介

A dump server plugin for roadrunner PHP app server

README 文档

README

A debugger / dumpserver for Roadrunner.

When I started working with Roadrunner for PHP, I found the debugging experience somewhat frustrating. I've grown used to Laravel's dump and dd functions and wanted something similar for Roadrunner development.

This is an attempat at that. It works as a plugin / Service for Roadrunner that you enable in your dev environment. It serves a UI on a given port where you can see the results of your dump calls.

Those calls are made using the global rrdump helper function.

Sample

Note while the gif mentions gRPC, it's not the case that this is limited to gRPC.

debug-gif

Setup

Appserver

In your main.go:

package main

import (
    // ...
	"github.com/spiral/roadrunner/service/rpc"
	dumpserver "github.com/khepin/rr-dumpserver"
)

func main() {
    // Other service registration
    // ...
	rr.Container.Register(rpc.ID, &rpc.Service{}) // rpc is required
	rr.Container.Register(dumpserver.ID, &dumpserver.Service{})

	rr.Execute()
}

In your .rr.yaml

rpc:
  enable: true
  listen: tcp://127.0.0.1:6001

dumpserver:
  enable: true
  HistorySize: 2000 # How many dumps to keep in memory
  address: :8089

PHP Code

Install the package via composer: composer require khepin/rr-dumpserver

Initialize the dumper with your RPC parameters:

use Khepin\RRDumpServer\RRDumper;
use Spiral\Goridge\RPC;
use Spiral\Goridge\SocketRelay;

$relay = new SocketRelay("127.0.0.1", 6001);
$rpc = new RPC($relay);

RRDumper::setupInstance($rpc);

Usage

From anywhere in your code, just call rrdump($var). Then navigate to localhost:8089 or whichever address / port you've made the dumpserver available at and review the dumped data in your browser.

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固