idmarinas/tracy-twig-bar

A Tracy panel for Twig Template Engine

Fund package maintenance!
Liberapay

0.3.1 2022-01-18 08:29 UTC

This package is auto-updated.

Last update: 2024-11-18 14:42:43 UTC


README

GitHub release GitHub Release Date GitHub code size in bytes Build in PHP

GitHub issues GitHub pull requests Github commits (since latest release) GitHub commit activity GitHub last commit

GitHub top language GitHub language count

Maintainability Code Climate technical debt

PayPal.Me - The safer, easier way to pay online! Liberapay - Donate Twitter

Twig Panel for Tracy

Add Twig template info in the Tracy debugger bar.

Installation

Composer

composer require --dev idmarinas/tracy-twig-bar

Usage

Somewhere, when your application start and you initialize Twig engine

use Idmarinas\TracyPanel\TwigBar;
use Idmarinas\TracyPanel\Twig\TracyExtension;
use Twig\Environment;
use Twig\Extension\ProfilerExtension;
use Twig\Profiler\Profile;

// ...
$profile = new Profile();
$env = new Environment($loader, $options);
$env->addExtension(new ProfilerExtension($profile));

/**
 * Optional Twig Extension.
 *
 * Can use `dump`, `dumpe` and `bdump` functions of Tracy
 */
$env->addExtension(new TracyExtension()); //-- Optional

TwigBar::init($profile);