PHPackages                             perchten/neat\_html - 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. [CLI &amp; Console](/categories/cli)
4. /
5. perchten/neat\_html

ActiveLibrary[CLI &amp; Console](/categories/cli)

perchten/neat\_html
===================

Pretty-print PHP objects and arrays in html, json etc.

1.4.1(11y ago)52.0kMITPHP

Since May 14Pushed 11y ago2 watchersCompare

[ Source](https://github.com/perchten/neat_html)[ Packagist](https://packagist.org/packages/perchten/neat_html)[ Docs](https://github.com/perchten/neat_html)[ RSS](/packages/perchten-neat-html/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

neat\_html
----------

[](#neat_html)

Prettier html printing of php objects and arrays

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

[](#installation)

##### Via Composer

[](#via-composer)

Neat\_html is available on Packagist ([perchten/neat\_html](https://packagist.org/packages/perchten/neat_html)) and as such is installable via [Composer](https://getcomposer.org/).

Add the following to your `composer.json`

```
{
	"require": {s
    	"perchten/neat_html": "1.*"
    }
}

```

##### Direct include

[](#direct-include)

Clone or download from [GitHub](https://github.com/perchten/neat_html) and include directly in your code:

```
require_once "path/to/neat_html.php"

```

Usage
-----

[](#usage)

##### Simple neat\_html

[](#simple-neat_html)

```
neat_html($somevar)

```

Will print `$somevar` into html as a ``-wrapped block formatted like JSON.

##### Return, Don't Print

[](#return-dont-print)

```
$output = neat_html($somevar,true)

```

As with `neat_html($somevar)` except that the output is returned, captured in the $output variable and not printed.

##### Die Immediately After Debug Print

[](#die-immediately-after-debug-print)

```
neat_html($somevar,"die")

```

Outputs the formatted `$somevar` and then dies.

##### Output as Html Comment

[](#output-as-html-comment)

```
neat_html($somevar,"comment")

```

Outputs the formatted code in comment form. comments start `\
