horizom / var-dumper
A nicer print_r/var_dump alternative
Requires
- php: >=7.0
Conflicts
README
VarDumper, or dump()
is a nicer alternative to PHP's print_r
/ var_dump
functions.
This project is a fork of the original project by digitalnature. A big thank you to him for the work he has done on his project.
DEMO
Or You can see full demo at Full demo
Installation using Composer
Add VarDumper to your composer.json
:
{ "require": { "horizom/var-dumper": "^3.1" } }
Now tell composer to download the bundle by running:
composer require horizom/var-dumper
Composer will install the bundle to the directory vendor/horizom
.
Usage
Basic example:
// include the class (not needed if project runs with Composer because it's auto-loaded) require 'vendor/autoload.php'; // display info about defined classes dump(get_declared_classes()); // display info about global variables dump($GLOBALS);
To print in text mode you can use the dump_text()
function instead:
dump_text($var);
To terminate the script after the info is dumped, prepend the bitwise NOT operator:
~dump($var); // html ~dump_text($var); // text
Prepending the error control operator (@) will return the information:
$output = @dump($var); // html $output = @dump_text($var); // text
Keyboard shortcuts (javascript must be enabled):
X
- collapses / expands all levelsCtrl
+X
- toggles display state
To modify the global configuration call \Horizom\VarDumper\VarDumper::config()
:
// example: initially expand first 3 levels \Horizom\VarDumper\VarDumper::config('expLvl', 3);
You can also add configuration options in your php.ini
file like this:
[varDumper] varDumper.expLvl = 3 varDumper.maxDepth = 4
Currently available options and their default values:
TODOs
- Inherit DocBlock comments from parent or prototype, if missing
- Refactor "bubbles" (for text-mode)
- Correctly indent multi-line strings (text-mode)
- Move separator tokens to ::before and ::after pseudo-elements (html-mode)
Changelog
All notable changes to this project will be documented in the file CHANGELOG.
License
The Horizom framework is open-sourced software licensed under the MIT license.