PHP code example of frost-byte / twig
1. Go to this page and download the library: Download frost-byte/twig 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/ */
frost-byte / twig example snippets
$psr4 = [
'Config' => APPPATH . 'Config',
APP_NAMESPACE => APPPATH,
'App' => APPPATH,
'frost-byte\Twig' => APPPATH . 'ThirdParty/twig/src'
];
$twig = new \FrostByte\Twig\Twig();
$twig->display('view.html', []);
$twig = new Config\Services::twig();
$twig->display('view.html', []);
protected $helpers = ['twig_helper'];
$twig = twig_instance();
$twig->display('view.html', []);
$twig = new \FrostByte\Twig\Twig();
$session = Config\Services::session();
$session->set(['name' => 'frost-byte']);
$twig->addGlobal('session', $session);
$twig->display('view.html', []);
$twig = new \FrostByte\Twig\Twig();
$result = $twig->renderTemplateMacro(
'macros.html',
'greet',
['name' => 'frost-byte']
);
public $useCloudCache = true;
public $bucket = [
'name' => 'your-gcs-bucket-name',
'directory' => 'directory-in-your-bucket'
];
public $keyFilePath = 'path/to/your/keyfile.json';
public $projectId = 'your-gcloud-project-id';