Quittio 0.3 API

BladeTemplateEngine
in package
implements TemplateEngine

FinalYes

Renders Blade views with the invoice view model as $invoice. The name "default" maps to the configured template. Template names may come from invoice data, so only these views can be selected: the configured template (quittio.pdf.template), the shipped views under "quittio::templates." (no partials) and the views of quittio.pdf.templates ("invoices.*" or "namespace::*" allows every view below a prefix). Names that are no Blade view fall back to the plain PHP templates, which resolve names inside their template directories only (never file paths).

Table of Contents

Interfaces

TemplateEngine
Turns the view model into HTML for the PDF renderer (Blade, plain PHP, Twig …).

Methods

__construct()  : mixed
allows()  : bool
fromSettings()  : self
The engine of the configuration: pdf.template for "default" and the views of pdf.templates (a missing key means ['invoices.*'], the views of make:quittio-template).
render()  : string

Methods

__construct()

public __construct(Factory $views[, string $defaultView = 'quittio::templates.default.layout' ][, PhpTemplateEngine $fallback = new PhpTemplateEngine() ][, array<int, string> $allowed = [] ]) : mixed
Parameters
$views : Factory
$defaultView : string = 'quittio::templates.default.layout'
$fallback : PhpTemplateEngine = new PhpTemplateEngine()
$allowed : array<int, string> = []

further selectable views or "prefix*" patterns

allows()

public allows(string $view) : bool
Parameters
$view : string
Return values
bool

fromSettings()

The engine of the configuration: pdf.template for "default" and the views of pdf.templates (a missing key means ['invoices.*'], the views of make:quittio-template).

public static fromSettings(Factory $views, Settings $settings) : self

Rendering and the preview use it, so both accept the same views.

Parameters
$views : Factory
$settings : Settings
Return values
self

render()

public render(string $template, InvoiceViewModel $invoice[, array<string|int, mixed> $data = [] ]) : string
Parameters
$template : string
$invoice : InvoiceViewModel
$data : array<string|int, mixed> = []

additional variables

Return values
string
On this page

Search results