PHP code example of antidot-fw / twig-template-renderer
1. Go to this page and download the library: Download antidot-fw/twig-template-renderer 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/ */
antidot-fw / twig-template-renderer example snippets
declare(strict_types=1);
use Antidot\Render\TemplateRenderer;
use Laminas\Diactoros\Response\HtmlResponse;
use Psr\Http\Server\RequestHandlerInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
class SomeHandler implements RequestHandlerInterface
{
private TemplateRenderer $template;
public function __construct(TemplateRenderer $template)
{
$this->template = $template;
}
public function handle(ServerRequestInterface $request) : ResponseInterface
{
return new HtmlResponse(
$this->template->render('index.html', [
'name' => 'Koldo ;-D',
])
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.