PHPackages                             nicedump/nicedump-twig - 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. [Templating &amp; Views](/categories/templating)
4. /
5. nicedump/nicedump-twig

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

nicedump/nicedump-twig
======================

Twig extension for dumping a variable in NiceDump format

v2.0.0(3y ago)03.3kMITPHPPHP &gt;=8.0

Since Dec 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/themichaelhall/nicedump-twig)[ Packagist](https://packagist.org/packages/nicedump/nicedump-twig)[ RSS](/packages/nicedump-nicedump-twig/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

NiceDump extension for Twig
===========================

[](#nicedump-extension-for-twig)

[![Tests](https://github.com/themichaelhall/nicedump-twig/workflows/tests/badge.svg?branch=master)](https://github.com/themichaelhall/nicedump-twig/actions)[![StyleCI](https://camo.githubusercontent.com/ebbd29ba684b63ec1eebace68e62d126a9ac8f0cc3a096ee314057f6056746c9/68747470733a2f2f7374796c6563692e696f2f7265706f732f3136333531333634302f736869656c643f7374796c653d666c6174266272616e63683d6d6173746572)](https://styleci.io/repos/163513640)[![License](https://camo.githubusercontent.com/6661cc39d5e1d9ce38ce42e2537e46742385b14bd45b794fb7b68c036ece5655/68747470733a2f2f706f7365722e707567782e6f72672f6e69636564756d702f6e69636564756d702d747769672f6c6963656e7365)](https://packagist.org/packages/nicedump/nicedump-twig)[![Latest Stable Version](https://camo.githubusercontent.com/eab94623998f82677d2a99337f821f88db8294f46a0fc880d3a81cec1479182d/68747470733a2f2f706f7365722e707567782e6f72672f6e69636564756d702f6e69636564756d702d747769672f762f737461626c65)](https://packagist.org/packages/nicedump/nicedump-twig)[![Total Downloads](https://camo.githubusercontent.com/327246d5c6ba5d9114fa5b7eb0b6f124abfbb1c4a16af4e9dd41b4dcae5fc7d4/68747470733a2f2f706f7365722e707567782e6f72672f6e69636564756d702f6e69636564756d702d747769672f646f776e6c6f616473)](https://packagist.org/packages/nicedump/nicedump-twig)

Twig extension to dump a variable according to the [NiceDump format specification](https://nicedump.net/).

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0

Install with composer
---------------------

[](#install-with-composer)

```
$ composer require nicedump/nicedump-twig
```

Basic usage
-----------

[](#basic-usage)

After enabling this extension, the `nice_dump()` function can be used in Twig templates to output a variable in NiceDump format.

The variable is only output if debug mode is enabled in Twig, otherwise `nice_dump()` returns just an empty string. This makes it possible to use the function both in development and production mode.

### Dump a variable

[](#dump-a-variable)

```
{{ nice_dump(foo) }}

```

This may output something like this:

```

```

Notice that the NiceDump in enclosed in an HTML comment.

### Dump a variable with a name

[](#dump-a-variable-with-a-name)

```
{{ nice_dump(foo, 'Foo') }}

```

### Dump a variable with a name and a comment

[](#dump-a-variable-with-a-name-and-a-comment)

```
{{ nice_dump(foo, 'Foo', 'This is my Foo') }}

```

### Enable output in release mode

[](#enable-output-in-release-mode)

**Caution: This may unintentionally reveal secret data on a production server. Use with care!**

Enable `nice_dump()` to output a NiceDump, even when Twig is in non-debug mode:

```
use NiceDumpTwig\NiceDumpTwigExtension;

$extension = new NiceDumpTwigExtension();
$extension->enableInReleaseMode();
```

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~685 days

Total

3

Last Release

1327d ago

Major Versions

v1.1.0 → v2.0.02022-09-29

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

v1.1.0PHP &gt;=7.3

v2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/089e2c6ec82f339a9db0a9e6d99c60ce8d4ec6f26d6259ca5d6f9c9710e2c9a4?d=identicon)[nicedump](/maintainers/nicedump)

---

Top Contributors

[![themichaelhall](https://avatars.githubusercontent.com/u/1049696?v=4)](https://github.com/themichaelhall "themichaelhall (22 commits)")

---

Tags

twigdumpextensionnice

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nicedump-nicedump-twig/health.svg)

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

###  Alternatives

[shoot/shoot

Shoot aims to make providing data to your templates more manageable

40229.9k2](/packages/shoot-shoot)[redant/twig-components

Define reusable components in Twig.

3819.8k1](/packages/redant-twig-components)[umanit/twig-image-extension

An extension to facilitate the integration of responsive images' markup in Twig templates.

1042.2k](/packages/umanit-twig-image-extension)

PHPackages © 2026

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