PHP code example of aatis / template-renderer

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

    

aatis / template-renderer example snippets


$templateRenderer = new TemplateRenderer();
$templateRenderer->render('path/to/template', [
    'var_name' => 'value'
]);

enum ExtraTemplateFileExtension: string
{
    case EXTRA = '.extra';
}

class ExtraRenderer extends AbstractTemplateRenderer
{
    public const EXTENSION = ExtraTemplateFileExtension::EXTRA;

    public function render(string $template, array $vars = []): string
    {
        // Transform the special extension type template into a string
    }
}

class ExtraRenderer extends AbstractTemplateRenderer
{
    public const EXTENSION = ExtraTemplateFileExtension::EXTRA;

    public function render(string $template, array $vars = []): string
    {
        // do some stuff
        $content = $this->getTemplateContent($template, $vars);
        // do some stuff and return the content
    }
}