1. Go to this page and download the library: Download fvsch/kirby-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/ */
// Register the Twig plugin's template component
Kirby\Twig\Plugin::register();
// Render a simple template from the site/snippets directory
echo twig('@snippets/header.twig');
// Same, but passing some additionnal variables
echo twig('@snippets/header.twig', ['sticky'=>false]);
// Render a string
echo twig('Hello {{ who }}', ['who'=>'World!']);
site
└─ plugins
└─ twig
├─ lib
├─ src
└─ twig.php
site
└─ plugins
└─ composer
└─ composer.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.