Ladybug (Extensible PHP Dumper)

Categories

Component ID

2221781

Component name

Ladybug (Extensible PHP Dumper)

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

1836

Component created

Component changed

Component body

This module provides some integration with the Ladybug PHP Extensible Dumper.

https://github.com/raulfraile/ladybug

It's main usage is to provide a devel-like interface for inspecting variables during development, however the library contains a number of other useful inspection options as well.

Among other things, Ladybug is capable of inspecting simple variables, arrays, objects (including property visibility, methods and other information), resources, MySQL results, and others. It can return results serialized, and will also work from the CLI.

see https://github.com/raulfraile/ladybug/blob/master/doc/examples.md for some examples.

Usage

// Simple usage. 
// Dump a variable to Drupal's message area.
ldpm($some_variable);

// Returning dump information.
$dump = ld_inspect()->dump($some_variable);

// Is equivalent to...
DrupalldInspector::init()->dump($some_variable);

// Dump values as JSON.
$json = ld_json_dump($some_variable);

// Access the Ladybug dumper directly (say, to change the format to XML).
$ladybug = ld_inspect()->getLadybug();
$ladybug->setFormat('xml');
$xml = $ladybug->dump();

Requirements