PHP code example of joshualicense / govuk-frontend-twig

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

    

joshualicense / govuk-frontend-twig example snippets


use Composer\Autoload\ClassLoader;
use Twig\Loader\FilesystemLoader;

// Optional: get the vendor directory using reflection from any directory.
$reflection = new \ReflectionClass(ClassLoader::class);
$vendorDir = dirname($reflection->getFileName(), 2);

$loader = new FilesystemLoader();
$loader->addPath($vendorDir . '/joshualicense/govuk-frontend-twig/src/templates', 'govuk-frontend-twig');