2017 © Pedro Peláez
 

symfony-bundle ladybug-bundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

image

raulfraile/ladybug-bundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  • Friday, October 10, 2014
  • by raulfraile
  • Repository
  • 13 Watchers
  • 343 Stars
  • 768,751 Installations
  • PHP
  • 27 Dependents
  • 0 Suggesters
  • 51 Forks
  • 23 Open issues
  • 13 Versions
  • 2 % Grown

The README.md

LadybugBundle

Build Status Latest Stable Version Total Downloads Latest Unstable Version, (*1)

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:, (*2)

``` php <?php class UserController extends Controller { public function userAction($username) { ladybug_dump($username); // or just ld($username) } }, (*3)


``` jinja {{ user.username|ladybug_dump }}

Getting as a result:, (*4)

, (*5)

Installation

Step 1: Composer

Add the following line to the composer.json file:, (*6)

``` json { "require": { "raulfraile/ladybug-bundle": "~1.0" } }, (*7)

To actually install Ladybug in your project, download the composer binary and run it:

``` bash
wget http://getcomposer.org/composer.phar
# or
curl -O http://getcomposer.org/composer.phar

php composer.phar install

Step 2: Enable the bundle

Finally, enable the bundle in the kernel:, (*8)

``` php <?php // app/AppKernel.php, (*9)

public function registerBundles() { $bundles = array( // ... new RaulFraile\Bundle\LadybugBundle\RaulFraileLadybugBundle(), ); }, (*10)


## Examples It is possible to dump any variable, including arrays, objects and resources: ### Dumping an array ``` php <?php $var = array(1, 2, 3); ladybug_dump($var)

, (*11)

Dumping an object

``` php <?php ladybug_dump($this->getRequest()), (*12)


<img style="border:1px solid #ccc; padding:1px" src="https://github.com/raulfraile/LadybugBundle/raw/master/Resources/doc/images/request_example.png" /> 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: <img style="border:1px solid #ccc; padding:1px" src="https://github.com/raulfraile/LadybugBundle/raw/master/Resources/doc/images/profiler.png" /> To make use of the Ladybug logger, grab the `ladybug` service from the DIC, and call the `log` method: ``` php <?php class TestController { public function testAction() { $var = 1; $this->get('ladybug')->log($var); }

API reference

Ladybug automatically detects Symfony, Doctrine, Twig, Silex and other classes, and link them to the official documentation., (*13)

, (*14)

Configuration

You can configure ladybug library directly in your config.yml file. Here are the defaults:, (*15)

yaml raul_fraile_ladybug: theme: modern # select the theme: base, modern or custom themes expanded: false # true to expand all the variables tree by default silenced: false # true to ignore all ladybug calls, (*16)

Credits

License

LadybugBundle is released under the MIT License. See the bundled LICENSE file for details., (*17)

The Versions

10/10 2014

dev-master

9999999-dev https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

The Development Requires

twig dump tree ladybug

10/10 2014

v1.0.6

1.0.6.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

The Development Requires

twig dump tree ladybug

29/08 2014

v1.0.5

1.0.5.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

The Development Requires

twig dump tree ladybug

20/08 2014

v1.0.4

1.0.4.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

04/07 2014

v1.0.3

1.0.3.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

03/10 2013

v1.0.2

1.0.2.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

29/09 2013

v1.0.1

1.0.1.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

28/09 2013

v1.0.0

1.0.0.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

19/08 2013

0.x-dev

0.9999999.9999999.9999999-dev https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

07/08 2013

v0.7

0.7.0.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

21/07 2013

v1.0.0-alpha1

1.0.0.0-alpha1 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

21/07 2013

dev-ladybug_v1.0

dev-ladybug_v1.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug

12/05 2013

v0.6

0.6.0.0 https://github.com/raulfraile/LadybugBundle

Symfony2 bundle for Ladybug library (Simple and Extensible PHP Dumper)

  Sources   Download

MIT

The Requires

 

twig dump tree ladybug