承接 componenta/profiler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

componenta/profiler

Composer 安装命令:

composer require --dev componenta/profiler

包简介

Request and service profiling for Componenta framework — dev-only dependency

README 文档

README

Development-time profiler for request lifecycle, boot timing, service instrumentation, and timeline rendering.

Use this package as an optional development dependency. It is designed to be easy to disable in production: application code can depend on ProfilerInterface, while config decides whether the real profiler or a no-op integration is wired.

Installation

composer require componenta/profiler

This package intentionally does not declare extra.componenta.config-providers. Register Componenta\Profiler\ConfigProvider manually from development-only application config when profiling is enabled.

Requirements

  • PHP 8.4+

Related Packages

Package Why it matters here
psr/http-message / psr/http-server-middleware Timing and profiler middleware work with PSR-7 requests, PSR-7 responses, and PSR-15 handlers.
componenta/pipeline Profiling can wrap middleware pipelines.
componenta/app Boot timing and early marks belong to the application lifecycle.
componenta/di Service delegators can profile selected classes.

Core API

use Componenta\Profiler\Profiler;

$profiler = new Profiler();

$profiler->mark('boot');

$span = $profiler->span('controller');
// run work
$span->close();

$marks = $profiler->marks();

Marks are ordered records with labels, timestamps, memory usage, and type:

  • Point: instant marker
  • Begin: span start
  • End: span end

Early Bootstrap Marks

Marks is a process-global facade for points that happen before the DI container exists:

use Componenta\Profiler\Marks;

Marks::mark('autoload.loaded');

The application integration can merge these early marks into the configured ProfilerInterface.

Rendering

Renderers convert collected marks into formats useful for debugging:

  • JsonRenderer: structured machine-readable output.
  • ServerTimingRenderer: Server-Timing header value.
  • WaterfallRenderer: human-readable timeline.
  • CompositeRenderer: chooses among renderers.

HTTP And Framework Integration

The integration layer includes:

  • TimingMiddleware: marks PSR-15 request handling.
  • ProfilerMiddleware: exposes profiler output when a trigger matches.
  • TimingBootloader: records bootloader spans.
  • service delegators for profiling selected classes.
  • ProfilingPipelineFactory for wrapping middleware pipelines.

Triggers

Triggers decide whether profiling output should be enabled for a request:

  • query parameter trigger
  • header trigger
  • cookie trigger
  • composite trigger

This keeps profiling opt-in and avoids exposing profiler data by default.

DI Registration

ConfigProvider registers profiler services, renderers, triggers, and optional integration points. Keep the package dev-only unless the application has an explicit production observability use case.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固