PHPackages                             phpsoftbox/profiler - 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. phpsoftbox/profiler

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

phpsoftbox/profiler
===================

Lifecycle profiler contracts and runtime for PhpSoftBox

00PHP

Since Jun 20Pushed todayCompare

[ Source](https://github.com/phpsoftbox/profiler)[ Packagist](https://packagist.org/packages/phpsoftbox/profiler)[ RSS](/packages/phpsoftbox-profiler/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Profiler
========

[](#profiler)

`phpsoftbox/profiler` — легкое ядро профилирования lifecycle приложения.

Компонент не знает внутренности `Database`, `ORM`, `Router`, `Container` и других пакетов. Он предоставляет общий runtime API, registry collectors и хранилища trace. Каждый компонент реализует свою интеграцию самостоятельно.

Базовое использование
---------------------

[](#базовое-использование)

```
use PhpSoftBox\Profiler\Profiler;
use PhpSoftBox\Profiler\ProfilerRegistry;
use PhpSoftBox\Profiler\Store\FileProfilerStore;

$registry = new ProfilerRegistry();
$profiler = new Profiler(
    enabled: true,
    store: new FileProfilerStore(__DIR__ . '/local/profiler'),
    registry: $registry,
);

$profiler->startTrace('http.request', 'http');

$profiler->span('shipment.sort', function () {
    // измеряемый участок
}, tags: ['shipment_id' => 123]);

$trace = $profiler->finishTrace();
```

Component extensions
--------------------

[](#component-extensions)

Компоненты регистрируют collectors через `ProfilerExtensionInterface`.

```
$registry = new ProfilerRegistry();

foreach ($extensions as $extension) {
    $extension->register($registry);
}
```

Пример ожидаемых extensions:

- `PhpSoftBox\Database\Profiler\DatabaseProfilerExtension`;
- `PhpSoftBox\Orm\Profiler\OrmProfilerExtension`;
- `PhpSoftBox\Container\Profiler\ContainerProfilerExtension`;
- `PhpSoftBox\Router\Profiler\RouterProfilerExtension`;
- `PhpSoftBox\Inertia\Profiler\InertiaProfilerExtension`;
- `PhpSoftBox\Cache\Profiler\CacheProfilerExtension`;
- `PhpSoftBox\Resource\Profiler\ResourceProfilerExtension`.

HTTP middleware
---------------

[](#http-middleware)

```
use PhpSoftBox\Profiler\Middleware\ProfilerMiddleware;

$app->add(ProfilerMiddleware::class);
```

Middleware создает root trace `http.request`, добавляет `X-Profile-Id` и `Server-Timing`.

JSON API
--------

[](#json-api)

Для dev-панели можно подключить `ProfilerReportHandler`:

```
use PhpSoftBox\Profiler\Http\ProfilerReportHandler;

$routes->get('/__profiler/api/traces', ProfilerReportHandler::class);
$routes->get('/__profiler/api/traces/{trace}', ProfilerReportHandler::class);
```

Handler возвращает `404`, если профайлер выключен.

React debug panel
-----------------

[](#react-debug-panel)

Backend должен отдать в Inertia shared props:

```
'profiler' => [
    'enabled'  => $profiler->enabled(),
    'trace_id' => $profiler->traceId(),
    'endpoint' => '/__profiler',
],
```

На frontend:

```
import { DebugProvider, ProfilerDebugPanel } from '@phpsoftbox/debug';

```

`@phpsoftbox/debug` читает report по `trace_id`, показывает timeline и компонентные sections: `database`, `orm`, `container`, `router`, `inertia`.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0279d150240c97d210034878b0467462246dc14d29b5618157ff6a8be49a50e3?d=identicon)[inspector-who](/maintainers/inspector-who)

---

Top Contributors

[![inspector-who](https://avatars.githubusercontent.com/u/6973963?v=4)](https://github.com/inspector-who "inspector-who (1 commits)")

### Embed Badge

![Health badge](/badges/phpsoftbox-profiler/health.svg)

```
[![Health](https://phpackages.com/badges/phpsoftbox-profiler/health.svg)](https://phpackages.com/packages/phpsoftbox-profiler)
```

###  Alternatives

[phalcon/dd

This package will add the `dd` and `dump` helpers to your Phalcon application.

24296.9k27](/packages/phalcon-dd)[georgringer/backend-debug

Some debug helper for the TYPO3 backend

2032.4k1](/packages/georgringer-backend-debug)

PHPackages © 2026

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