PHP code example of imponeer / smarty-debug

1. Go to this page and download the library: Download imponeer/smarty-debug 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/ */

    

imponeer / smarty-debug example snippets


// Create a Smarty instance
$smarty = new \Smarty\Smarty();

// Register the debug extension
$smarty->addExtension(new \Imponeer\Smarty\Extensions\Debug\DebugExtension());

// Get the Smarty instance with the debug extension already added
$smarty = $container->get(\Smarty\Smarty::class);

use function DI\create;
use function DI\get;

return [
    // Configure Smarty with the extension
    \Smarty\Smarty::class => create()
        ->method('addExtension', get(\Imponeer\Smarty\Extensions\Debug\DebugExtension::class))
];

// Get the configured Smarty instance
$smarty = $container->get(\Smarty\Smarty::class);

// Create the container
$container = new \League\Container\Container();

// Register Smarty with the debug extension
$container->add(\Smarty\Smarty::class, function() {
    $smarty = new \Smarty\Smarty();
    // Configure Smarty...

    // Create and add the debug extension
    $extension = new \Imponeer\Smarty\Extensions\Debug\DebugExtension();
    $smarty->addExtension($extension);

    return $smarty;
});

// Get the configured Smarty instance
$smarty = $container->get(\Smarty\Smarty::class);