smbpunt / timeline-graph-bundle
Symfony profiler panel that draws how a request flows through your services, and replays it step by step.
Package info
github.com/smbpunt/TimelineGraphBundle
Type:symfony-bundle
pkg:composer/smbpunt/timeline-graph-bundle
Requires
- php: >=8.4
- symfony/config: ^8.0
- symfony/dependency-injection: ^8.0
- symfony/framework-bundle: ^8.0
- symfony/http-foundation: ^8.0
- symfony/http-kernel: ^8.0
- symfony/service-contracts: ^3.5
Requires (Dev)
- doctrine/dbal: ^4.2
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^13.2
- rector/rector: ^2.4
- symfony/browser-kit: ^8.0
- symfony/css-selector: ^8.0
- symfony/http-client: ^8.0
- symfony/twig-bundle: ^8.0
- symfony/web-profiler-bundle: ^8.0
Suggests
- ext-opentelemetry: Required to record calls (method hooks).
- symfony/web-profiler-bundle: Displays the Timeline Graph panel.
Provides
None
Conflicts
None
Replaces
None
README
Like the Symfony profiler's Timeline, but as a graph: see how a request flows through your services, then replay it step by step.
- One box per service, grouped by feature, one arrow per caller → callee with the methods called.
- Database, HTTP, LDAP and Twig calls shown as their own boxes.
- Failing paths highlighted in red.
- Replay player with step forward / back and breakpoints.
Dev only: nothing is registered when kernel.debug is off.
Requirements
- PHP 8.4+ with the
opentelemetryextension - Symfony 8 with the WebProfilerBundle
Installation
pecl install opentelemetry # or: install-php-extensions opentelemetry
composer require --dev smbpunt/timeline-graph-bundle
Symfony Flex registers the bundle for dev and test. Without Flex, add it to config/bundles.php:
Smbpunt\TimelineGraphBundle\TimelineGraphBundle::class => ['dev' => true, 'test' => true],
Usage
Open any request in the profiler and select the Timeline Graph panel.
- Space: play / pause
- ← →: step back / forward
- Click a box: toggle a breakpoint (kept across requests)
Configuration
Defaults:
# config/packages/timeline_graph.yaml when@dev: timeline_graph: include: ['App\'] exclude: ['App\Kernel', '*\Entity\*', '*\Dto\*', '*\ValueObject\*', '*\Enum\*'] group_depth: 2 # App\Catalog\… is grouped as "Catalog" max_calls: 500 # calls recorded per request
A pattern ending with \ is a namespace prefix; * matches any characters.
How it works
At compile time, the bundle lists the public methods of every matching service. At boot, it hooks each of them with the opentelemetry extension and records the calls of the request. The panel replays this recording in the browser: nothing runs again on the server.
Limitations:
- arguments and return values are not recorded;
- methods returning a generator are not traced;
- code that runs before the kernel boots (cache warmup) is not traced.
The graph layout uses elkjs, loaded from jsDelivr.
Contributing
make qa # php-cs-fixer, phpstan, rector, phpunit
License
MIT, see LICENSE.