Download the PHP package raulfraile/ladybug-bundle without Composer
On this page you can find all versions of the php package raulfraile/ladybug-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download raulfraile/ladybug-bundle
More information about raulfraile/ladybug-bundle
Files in raulfraile/ladybug-bundle
Package ladybug-bundle
Short Description Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)
License MIT
Homepage https://github.com/raulfraile/LadybugBundle
Informations about the package ladybug-bundle
LadybugBundle
This bundle provides an easy and extensible var_dump/print_r replacement for Symfony2 projects, both in controllers or Twig templates. For example, with this bundle, the following is possible:
Getting as a result:
Installation
Step 1: Composer
Add the following line to the composer.json
file:
To actually install Ladybug in your project, download the composer binary and run it:
Step 2: Enable the bundle
Finally, enable the bundle in the kernel:
Examples
It is possible to dump any variable, including arrays, objects and resources:
Dumping an array
Dumping an object
The same can be accomplished using the Twig filter ladybug_dump
.
Helpers
The are 5 helpers that can be used in any controller:
ladybug_dump($var1[, $var2[, ...]])
: Dumps one or more variables
ladybug_dump_die($var1[, $var2[, ...]])
: Dumps one or more variables and
terminates the current script
ladybug_dump_return($format, $var1[, $var2[, ...]])
: Dumps one or more variables and
returns the dump in any of the following formats:
- yml: Returns the dump in YAML
- json: Returns the dump in JSON
- xml: Returns the dump in XML
- php: Returns the dump in PHP arrays
ladybug_dump_ini([$extension])
: Dumps all configuration options
ladybug_dump_ext()
: Dumps loaded extensions
There are also some shortcuts in case you are not using this function names:
ld($var1[, $var2[, ...]])
: shortcut for ladybug_dump
ldd($var1[, $var2[, ...]])
: shortcut for ladybug_dump_die
ldr($format, $var1[, $var2[, ...]])
: shortcut for ladybug_return
Only ladybug_dump
can be used inside Twig templates.
Symfony profiler integration
Instead of printing out the dump tree inside the HTML document, you can use the Ladybug logger and see the results in a tab of the Symfony profiler:
To make use of the Ladybug logger, grab the ladybug
service from the DIC, and call the log
method:
API reference
Ladybug automatically detects Symfony, Doctrine, Twig, Silex and other classes, and link them to the official documentation.
Configuration
You can configure ladybug library directly in your config.yml
file. Here are the defaults:
Credits
- Raul Fraile (@raulfraile)
- All contributors
License
LadybugBundle is released under the MIT License. See the bundled LICENSE file for details.
All versions of ladybug-bundle with dependencies
symfony/framework-bundle Version >=2.0.0
raulfraile/ladybug Version ~1.0.0
raulfraile/ladybug-plugin-symfony2 Version ~1.0.0