1. Go to this page and download the library: Download cakephp/twig-view 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/ */
cakephp / twig-view example snippets
// In controller
public function initialize(): void
{
$this->viewBuilder()->setOption('environment', ['cache' => false]);
}
// In your AppView
public function initialize(): void
{
$this->setConfig('environment', ['cache' => false]);
// Call parent TwigView initialize
parent::initialize();
}
namespace App\View;
use Cake\TwigView\View\TwigView;
class AppView extends TwigView
{
public function initialize(): void
{
parent::initialize();
// Add application-specific extensions
}
}
protected function createLoader(): \Twig\Loader\LoaderInterface
{
// Return a custom Twig template loader
}
protected function initializeExtensions(): void
{
// Load only specific extensions
}
- Twig Profiler
You can override the Twig profiler used when `DebugKit` is loaded.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.