PHPackages                             imponeer/smarty-debug - 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. imponeer/smarty-debug

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

imponeer/smarty-debug
=====================

Smarty plugin to debug template data

v3.0.3(5mo ago)411.6k↓50%MITPHPPHP ^8.3CI failing

Since Feb 1Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/imponeer/smarty-debug)[ Packagist](https://packagist.org/packages/imponeer/smarty-debug)[ RSS](/packages/imponeer-smarty-debug/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (19)Used By (0)

[![License](https://camo.githubusercontent.com/dc0ad0b493e90c6acc78510e14fa5584b8a44e89767a6376c56fb015036df870/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f696d706f6e6565722f736d617274792d64656275672e737667)](LICENSE)[![GitHub release](https://camo.githubusercontent.com/98e004d9146907fdcdf57d74e3922e3362a218a3acf50b6de32c64e5da002043/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f696d706f6e6565722f736d617274792d64656275672e737667)](https://github.com/imponeer/smarty-debug/releases) [![PHP](https://camo.githubusercontent.com/142a9efa56370f0e2db1ccc948cecacb8949a8e5af8b9ed9c3ec930fe06e6641/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696d706f6e6565722f736d617274792d64656275672e737667)](http://php.net)[![Packagist](https://camo.githubusercontent.com/002e5325b40be138fea8a973e16b3069c62fc0008fe527b177401a8f523ef2d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f696d706f6e6565722f736d617274792d64656275672e737667)](https://packagist.org/packages/imponeer/smarty-debug)[![Smarty version requirement](https://camo.githubusercontent.com/0591ec89663be776d49a8de2e37b24137966dfd50cc9983cc3886f161365593a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f696d706f6e6565722f736d617274792d64656275672f736d61727479253246736d61727479)](https://smarty-php.github.io)

Smarty Debug
============

[](#smarty-debug)

> Powerful debugging tools for Smarty templates

This library extends Smarty with specialized debugging capabilities, allowing developers to easily inspect variables and troubleshoot template issues. It integrates with Symfony's VarDumper component to provide rich, formatted output of complex data structures directly in your templates.

Installation
------------

[](#installation)

To install and use this package, we recommend to use [Composer](https://getcomposer.org):

```
composer require imponeer/smarty-debug
```

Otherwise, you need to include manually files from `src/` directory.

Setup
-----

[](#setup)

### Basic Setup

[](#basic-setup)

To register the debug extension with Smarty, add the extension class to your Smarty instance:

```
// Create a Smarty instance
$smarty = new \Smarty\Smarty();

// Register the debug extension
$smarty->addExtension(new \Imponeer\Smarty\Extensions\Debug\DebugExtension());
```

### Using with Symfony Container

[](#using-with-symfony-container)

To integrate with Symfony, you can leverage autowiring, which is the recommended approach for modern Symfony applications:

```
# config/services.yaml
services:
    # Enable autowiring and autoconfiguration
    _defaults:
        autowire: true
        autoconfigure: true

    # Register your application's services
    App\:
        resource: '../src/*'
        exclude: '../src/{DependencyInjection,Entity,Tests,Kernel.php}'

    # Configure Smarty with the extension
    # The DebugExtension will be autowired automatically
    \Smarty\Smarty:
        calls:
            - [addExtension, ['@Imponeer\Smarty\Extensions\Debug\DebugExtension']]
```

Then in your application code, you can simply retrieve the pre-configured Smarty instance:

```
// Get the Smarty instance with the debug extension already added
$smarty = $container->get(\Smarty\Smarty::class);
```

### Using with PHP-DI

[](#using-with-php-di)

With PHP-DI container, you can take advantage of autowiring for a very simple configuration:

```
use function DI\create;
use function DI\get;

return [
    // Configure Smarty with the extension
    \Smarty\Smarty::class => create()
        ->method('addExtension', get(\Imponeer\Smarty\Extensions\Debug\DebugExtension::class))
];
```

Then in your application code, you can retrieve the Smarty instance:

```
// Get the configured Smarty instance
$smarty = $container->get(\Smarty\Smarty::class);
```

### Using with League Container

[](#using-with-league-container)

If you're using League Container, you can register the extension like this:

```
// Create the container
$container = new \League\Container\Container();

// Register Smarty with the debug extension
$container->add(\Smarty\Smarty::class, function() {
    $smarty = new \Smarty\Smarty();
    // Configure Smarty...

    // Create and add the debug extension
    $extension = new \Imponeer\Smarty\Extensions\Debug\DebugExtension();
    $smarty->addExtension($extension);

    return $smarty;
});
```

Then in your application code, you can retrieve the Smarty instance:

```
// Get the configured Smarty instance
$smarty = $container->get(\Smarty\Smarty::class);
```

Usage
-----

[](#usage)

This extension provides modifiers that help with debugging variables in your Smarty templates.

### debug\_print\_var

[](#debug_print_var)

The `debug_print_var` modifier displays the content of a variable in a human-readable format. It works with various data types including strings, numbers, booleans, arrays, and objects.

```
{$variable|debug_print_var}
```

#### Examples

[](#examples)

**Debugging a simple variable:**

```
{"Hello World"|debug_print_var}
```

**Debugging an array:**

```
{$userArray|debug_print_var}
```

**Debugging a template variable:**

```
{$smarty.session|debug_print_var}
```

**Debugging a configuration variable:**

```
{"_AD_INSTALLEDMODULES"|debug_print_var}
```

Development
-----------

[](#development)

### Code Quality Tools

[](#code-quality-tools)

This project uses several tools to ensure code quality:

- **PHPUnit** - For unit testing

    ```
    composer test
    ```
- **PHP CodeSniffer** - For coding standards (PSR-12)

    ```
    composer phpcs    # Check code style
    composer phpcbf   # Fix code style issues automatically
    ```
- **PHPStan** - For static analysis

    ```
    composer phpstan
    ```

Documentation
-------------

[](#documentation)

API documentation is automatically generated and available in the project's wiki. For more detailed information about the classes and methods, please refer to the [project wiki](https://github.com/imponeer/smarty-debug/wiki).

Contributing
------------

[](#contributing)

Contributions are welcome! Here's how you can contribute:

1. Fork the repository
2. Create a feature branch: `git checkout -b feature-name`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature-name`
5. Submit a pull request

Please make sure your code follows the PSR-12 coding standard and include tests for any new features or bug fixes.

If you find a bug or have a feature request, please create an issue in the [issue tracker](https://github.com/imponeer/smarty-debug/issues).

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance81

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 61.3% 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.

###  Release Activity

Cadence

Every ~110 days

Recently: every ~198 days

Total

17

Last Release

169d ago

Major Versions

v1.1.6 → v2.0.02023-02-01

v2.0.3 → v3.0.02025-05-14

PHP version history (3 changes)v1.0.0PHP &gt;=7.1

v2.0.0PHP ^7.3 || ^8.0

v3.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/dba53e399a507d1f60626164c8b1e340a5cc0dc4f0637f4c6aaff8fc239fdaee?d=identicon)[fiammybe](/maintainers/fiammybe)

![](https://www.gravatar.com/avatar/7255f306e0ca27292c50cdd9644c1c04e0d7b0f54bf35e0cdd79dc55c83b4923?d=identicon)[MekDrop](/maintainers/MekDrop)

![](https://www.gravatar.com/avatar/79009323fafcd4974bb1713b12eea0a610f01c4fb21cc5e85d446c4cb66453d4?d=identicon)[skenow](/maintainers/skenow)

---

Top Contributors

[![MekDrop](https://avatars.githubusercontent.com/u/342641?v=4)](https://github.com/MekDrop "MekDrop (49 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![Codex](https://avatars.githubusercontent.com/in/2248422?v=4)](https://github.com/Codex "Codex (2 commits)")[![fiammybe](https://avatars.githubusercontent.com/u/3736946?v=4)](https://github.com/fiammybe "fiammybe (2 commits)")[![mend-bolt-for-github[bot]](https://avatars.githubusercontent.com/in/16809?v=4)](https://github.com/mend-bolt-for-github[bot] "mend-bolt-for-github[bot] (1 commits)")

---

Tags

debugginghacktoberfestsmartysmarty-pluginsvar-dumpvar-dumpersymfonydebugsmartyvar-dumpersmarty-plugins

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/imponeer-smarty-debug/health.svg)

```
[![Health](https://phpackages.com/badges/imponeer-smarty-debug/health.svg)](https://phpackages.com/packages/imponeer-smarty-debug)
```

###  Alternatives

[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k21.3M40](/packages/php-debugbar-php-debugbar)[kendrick/symfony-debug-toolbar-git

Git information into Symfony Debug Toolbar

3060.2k1](/packages/kendrick-symfony-debug-toolbar-git)[symfony/ai-mate

AI development assistant MCP server for Symfony projects

1624.9k11](/packages/symfony-ai-mate)[keversc/var-trumper

Add a citation of D. Trump to your dumps while debugging

161.5k](/packages/keversc-var-trumper)[polcode/unit-converter-bundle

This bundle allows you to manage values in different units by simply command

1017.5k](/packages/polcode-unit-converter-bundle)[awesomite/var-dumper

The alternative for var\_dump function

1015.4k2](/packages/awesomite-var-dumper)

PHPackages © 2026

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