定制 perftools/php-profiler-laravel 二次开发

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

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

perftools/php-profiler-laravel

最新稳定版本:0.2.0

Composer 安装命令:

composer require perftools/php-profiler-laravel

包简介

Laravel Octane bridge for perftools/php-profiler

README 文档

README

Laravel Octane bridge for perftools/php-profiler.

This package wires the core profiler into the Laravel Octane request lifecycle.

It starts profiling on RequestReceived and stops profiling on RequestTerminated.

Scope

  • Laravel Octane only.
  • No FPM, queue worker, or Artisan profiling lifecycle is provided here.
  • Runtime failures are logged and do not break the request.

Requirements

  • PHP 8.2+
  • illuminate/support ^10.0, ^11.0, ^12.0, or ^13.0
  • laravel/octane ^2.3
  • perftools/php-profiler ^1.4

Installation

Install the package into a Laravel Octane application:

composer require perftools/php-profiler-laravel

Service provider

Laravel package discovery registers the provider automatically:

Xhgui\Profiler\Laravel\XhguiProfilerServiceProvider

If you disable discovery, register that provider manually.

Configuration

Publish the package config:

php artisan vendor:publish --tag=xhgui-config

The package owns the enabled toggle and ships a default file-based saver example. Profiling is disabled by default, so enabling it is an explicit opt-in. The resulting config/xhgui.php is passed to the core profiler.

Default config shape:

<?php

use Xhgui\Profiler\Profiler;

return [
    'enabled' => env('XHGUI_ENABLED', false),
    'save.handler' => env('XHGUI_SAVE_HANDLER', Profiler::SAVER_FILE),
    'save.handler.file' => [
        'filename' => env('XHGUI_SAVE_FILE', storage_path('logs/xhgui/profile.jsonl')),
    ],
];

You can replace the saver-related settings with any config supported by the core perftools/php-profiler library.

If you set the profiler.request_context_provider key in config/xhgui.php before profiling starts, for example:

use App\Profiling\AppRequestContextProvider;

return [
    'profiler.request_context_provider' => new AppRequestContextProvider(),
];

The package ignores it. Laravel Octane integration always injects its own OctaneRequestContextProvider so request context is captured from the current Octane request.

Contributing

See CONTRIBUTING.md for local development setup and verification, package behavior notes, and scope reminders.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固