PHP code example of ldf / gutenberg

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

    

ldf / gutenberg example snippets


$Gutenberg = Gutenberg::ForWorkspace('./path/to/templates');

// Get the object
$Gutenberg = Gutenberg::ForWorkspace('./path/to/templates')
    ->withWipeOut();

// Call the render function to get the rendered page    
return $Gutenberg->render('page', [
    'var1' => 'value1',
    'var2' => 'value2',
]);

$Gutenberg = Gutenberg::ForWorkspace('./path/to/templates')
    ->withWipeOut()
    ->get();

class MyCustomCompiler implements \Ldf\Gutenberg\ICompiler
{
    public function compile(string $tpl) : string
    {
        ...
    }
}

Gutenberg::ForWorkspace('./FakeTemplates')
    ->addCustomCompiler($myCustomCompiler1)
    ->addCustomCompiler($myCustomCompiler2)