API reference / Quittio \ Core \ Templates
PhpTemplateEngine
final class in quittio/core · implements TemplateEngine
Quittio\Core\Templates\PhpTemplateEngine · Source
Plain PHP templates for use without Laravel.
A template is a PHP file that receives $invoice (view model) and $e (escape function). The name "default" refers to the template shipped with the core.
Template names are never file paths: "custom" or "invoices/modern" resolve to "{path}/{name}.php" inside one of the configured directories (or the shipped templates), so a name from a request or from invoice data cannot include an arbitrary file.
Methods#
| Method | Description |
|---|---|
->__construct() | |
->render() |
__construct()#
public function __construct(list<string> $paths = [])| Parameter | Type | Description |
|---|---|---|
$paths | list<string> = [] | directories searched for "{name}.php" |
render()#
public function render(
string $template,
InvoiceViewModel $invoice,
array $data = [],
): string| Parameter | Type | Description |
|---|---|---|
$template | string | |
$invoice | InvoiceViewModel | |
$data | array = [] |
- Returns
string