InvoiceTemplate
Abstract class that all Invoice Templates must extend
Attributes
- #[AllowDynamicProperties]
Table of Contents
Methods
| download() | Outputs the Invoice document to stdout, sending the appropriate headers to force a download of the document |
| fetch() | Returns the invoice document in the desired format |
| getAuthors() | Returns the name and URL for the authors of this invoice PDF template |
| getFileExtension() | Returns the file extension for the given (supported) mime type |
| getName() | Returns the name of this invoice PDF template |
| getVersion() | Returns the version of this invoice PDF template |
| includeAddress() | Sets whether or not to include the To address information in the invoice document |
| makeDocument() | Generates one or more invoices for a single document |
| setCurrency() | Sets the CurrencyFormat object for parsing currency values |
| setDate() | Sets the Date object for parsing date values |
| setMeta() | Sets the meta data to use for this invoice. This method is invoked after __construct() but before makeDocument() |
| setMimeType() | Sets the MIME type to be used when fetching and streaming this invoice. |
| stream() | Outputs the Invoice document to stdout, sending the apporpriate headers to render the document inline |
| supportedMimeTypes() | Returns the MIME types that this template supports for output |
| supportsQuotes() | Determine whether this invoice template supports quotes |
Methods
download()
Outputs the Invoice document to stdout, sending the appropriate headers to force a download of the document
public
abstract download([string $name = null ]) : mixed
Parameters
- $name : string = null
-
The name of the document minus the extension (optional).
fetch()
Returns the invoice document in the desired format
public
abstract fetch() : string
Return values
string —The document in binary format
getAuthors()
Returns the name and URL for the authors of this invoice PDF template
public
abstract getAuthors() : array<string|int, mixed>
Return values
array<string|int, mixed> —The name and URL of the authors of this invoice PDF template
getFileExtension()
Returns the file extension for the given (supported) mime type
public
abstract getFileExtension(string $mime_type) : string
Parameters
- $mime_type : string
-
The mime_type to fetch the extension of
Return values
string —The extension to use for the given mime type
getName()
Returns the name of this invoice PDF template
public
abstract getName() : mixed
getVersion()
Returns the version of this invoice PDF template
public
abstract getVersion() : string
Return values
string —The current version of this invoice PDF template
includeAddress()
Sets whether or not to include the To address information in the invoice document
public
abstract includeAddress([bool $include_address = true ]) : mixed
Parameters
- $include_address : bool = true
-
True to include the to address information, false to leave the information off of the document
makeDocument()
Generates one or more invoices for a single document
public
abstract makeDocument(array<string|int, mixed> $invoice_data) : mixed
Parameters
- $invoice_data : array<string|int, mixed>
-
An numerically indexed array of stdClass objects each representing an invoice
Tags
setCurrency()
Sets the CurrencyFormat object for parsing currency values
public
abstract setCurrency(CurrencyFormat $currency_format) : mixed
Parameters
- $currency_format : CurrencyFormat
-
The CurrencyFormat object
setDate()
Sets the Date object for parsing date values
public
setDate(Date $date) : mixed
Parameters
- $date : Date
-
The Date object
setMeta()
Sets the meta data to use for this invoice. This method is invoked after __construct() but before makeDocument()
public
abstract setMeta(array<string|int, mixed> $meta) : mixed
Parameters
- $meta : array<string|int, mixed>
-
An array of meta data including:
- background The absolute path to the background graphic
- logo The absolute path to the logo graphic
- company_name The name of the company
- company_address The address of the company
- terms The terms to display on this invoice
- paper_size The size of paper to use (e.g. "A4" or "Letter")
- tax An array of tax info including:
- tax_id The Tax ID/VATIN of this company
- cascade_tax Whether or not taxes are cascading
setMimeType()
Sets the MIME type to be used when fetching and streaming this invoice.
public
abstract setMimeType(string $mime_type) : mixed
Called after __construct()
Parameters
- $mime_type : string
-
The mime_type to render ("application/pdf", "text/html", etc.)
stream()
Outputs the Invoice document to stdout, sending the apporpriate headers to render the document inline
public
abstract stream([string $name = null ]) : mixed
Parameters
- $name : string = null
-
The name of the document minus the extension (optional).
supportedMimeTypes()
Returns the MIME types that this template supports for output
public
abstract supportedMimeTypes() : mixed
supportsQuotes()
Determine whether this invoice template supports quotes
public
supportsQuotes() : bool