PHP code example of gajus / brick

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

    

gajus / brick example snippets


// Set the absolute path to the folder containing templates.
$system = new \Gajus\Brick\System(__DIR__ . '/templates');
// Refer to the template using a path relative to the template folder.
echo $system->view('foo');

$system->setTemplateExtension('.tpl.php');

// template_that_is_using_foo_variable.php
$foo;

$system->view('template_that_is_using_foo_variable', ['foo' => 'bar']); // 'bar'

$system->getGlobals(['foo' => 'bar']);
$system->view('template_that_is_using_foo_variable'); // 'bar'