1. Go to this page and download the library: Download moss/twig-bridge 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/ */
moss / twig-bridge example snippets
{{ $value|number }} - formats $value as number
{{ $value|currency }} - formats $value as currency
{{ $value|time }} - formats $value (which must be a \DateTime object) as time
{{ $value|date }} - formats $value (\DateTime object) as date
{{ $value|dateTime }} - formats $value (\DateTime object) as date time
'view' => array(
'closure' => function (\Moss\Container\Container $container) {
$options = array(
'debug' => true,
'auto_reload' => true,
'strict_variables' => false,
'cache' => '../compile/'
);
$twig = new Twig_Environment(new Moss\Bridge\Loader\File(), $options);
$twig->setExtensions(
array(
new Moss\Bridge\Extension\Resource(),
new Moss\Bridge\Extension\Url($container->get('router')),
new Moss\Bridge\Extension\Trans(),
new Twig_Extensions_Extension_Text(),
)
);
$view = new \Moss\Bridge\View\View($twig);
$view
->set('request', $container->get('request'))
->set('config', $container->get('config'));
return $view;
}
)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.