PHP code example of smart-core / ladybug-bundle

1. Go to this page and download the library: Download smart-core/ladybug-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

smart-core / ladybug-bundle example snippets

 php

    class UserController extends Controller
    {
        public function userAction($username) {
            ladybug_dump($username); // or just ld($username)
        }
    }
 jinja
{{ user.username|ladybug_dump }}
 php

// app/autoload.php

$loader->registerNamespaces(array(
    // ...
    'Ladybug'           => __DIR__.'/../vendor/Ladybug/lib',
    'RaulFraile'        => __DIR__.'/../vendor/bundles',
));
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new RaulFraile\Bundle\LadybugBundle\RaulFraileLadybugBundle(),
    );
}
 php

    $var = array(1, 2, 3);
    ladybug_dump($var)
 php

    $var = new Foo();
    ladybug_dump($var)
 php

    $img = imagecreatefrompng(__DIR__ . '/images/ladybug.png');
    ladybug_dump($img);
 bash
# php app/console ladybug:dump class_name [--all]
# php app/console ladybug:export class_name target [--format=yaml]

php app/console ladybug:dump "Symfony\Component\HttpFoundation\Request"
php app/console ladybug:export "Symfony\Component\HttpFoundation\Request" export.json --format=json
 php

class TestController
{
    public function testAction()
    {
        $var = 1;
        $this->get('ladybug')->log($var);
    }