1. Go to this page and download the library: Download daun/statamic-latte 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/ */
daun / statamic-latte example snippets
use Daun\StatamicLatte\Components\Component;
class Alert extends Component
{
public function __construct(
public string $type = 'info',
) {}
public function data(): array
{
return [...parent::data(), 'classes' => "alert alert-{$this->type}"];
}
}
latte
<h1>{$entry->title}</h1> {* text field → escaped, even if it holds <a> *}
<div>{$entry->content}</div> {* markdown field → <p>…</p>, as markup *}