Skip to content

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#

MethodDescription
->__construct()
->render()

__construct()#

public function __construct(list<string> $paths = [])
ParameterTypeDescription
$pathslist<string> = []directories searched for "{name}.php"

render()#

public function render(
    string $template,
    InvoiceViewModel $invoice,
    array $data = [],
): string
ParameterTypeDescription
$templatestring
$invoiceInvoiceViewModel
$dataarray = []
Returns
string

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.