1. Go to this page and download the library: Download jdwx/web-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/ */
jdwx / web-twig example snippets
class ErrorPage extends StaticPage {
/** @param array<string, mixed> $i_rValues */
public function __construct( string $name, array $i_rValues = [] ) {
# Give it the path to your error templates.
$env = TwigHelper::forDirectory( __DIR__ . '/templates/' );
parent::__construct( $env, $name, $i_rValues );
}
/** @param array<string, mixed> $i_rValues */
public static function get( string $name, array $i_rValues = [] ) : string {
return ( new self( $name, $i_rValues ) )->render();
}
}