API reference / Quittio \ Core
Config
final readonly class in quittio/core
Quittio\Core\Config · Source
Configuration of the core without Laravel. The Laravel package translates config/quittio.php into it (Quittio\Laravel\Support\ConfigMapper), whose layout differs from the keys of fromArray().
Constants#
| Constant | Value | Description |
|---|---|---|
VALIDATION_ERROR | 'error' | |
VALIDATION_OFF | 'off' | |
VALIDATION_WARN | 'warn' |
Properties#
| Property | Type | Description |
|---|---|---|
$autoUpgradeProfile readonly | bool | |
$b2cEmbedXml readonly | bool | |
$blockOnWarnings readonly | bool | |
$calculation readonly | CalculationPolicy | what the calculator does with declared amounts |
$cancellationStrategy readonly | string|null | credit_note or negative_invoice; null = default of the country pack |
$country readonly | ?string | |
$countrySettings readonly | array<string, array<string, mixed>> | settings of the country packs by lower-case code, e.g. ['de' => ['consumer_default_notice' => false]] (Laravel: quittio.countries.de) |
$dueDays readonly | int|null | due date (BT-9) = issue date + days for invoices without due date and payment terms |
$filename readonly | string | |
$format readonly | string|null | default output format, null = automatic choice |
$girocodeAmount readonly | string | |
$kosit readonly | array{Quittio\Core\mode?: string, Quittio\Core\url?: string, Quittio\Core\jar?: string|null, Quittio\Core\configurations?: list<array{scenarios: string, repository: string}>, Quittio\Core\java?: string, Quittio\Core\timeout?: int, Quittio\Core\fail_on_unavailable?: bool}|null | null = disabled |
$locale readonly | ?string | |
$mandatoryFields readonly | string | |
$maxDecompressedBytes readonly | int | |
$maxPdfBytes readonly | int | |
$maxXmlBytes readonly | int | |
$options readonly | array<string, mixed> | options for validation rules and the view model |
$pdfa readonly | bool | |
$presentation readonly | Presentation|null | design defaults (logo, colours, texts); the invoice's own values win |
$profile readonly | string|null | default profile for every format that allows it; null = the profile of the format or of the automatic choice (EN 16931 for ZUGFeRD/Factur-X) |
$rules readonly | RuleOverrides | PHP rules switched off, re-rated or replaced by code |
$tempDir readonly | ?string | |
$template readonly | string | |
$templatePaths readonly | list<string> | directories for plain PHP templates |
$validation readonly | string | error (throw on errors), warn (attach result only) or off |
$validationLevels readonly | list<ValidationLevel> | levels run while rendering |
$validationLocale readonly | string|null | language of validation messages: null or "invoice" = the language of the invoice, "app" = the language of the application translator (Laravel: app()->getLocale()), or a locale |
$veraPdf readonly | array{Quittio\Core\mode?: string, Quittio\Core\binary?: string, Quittio\Core\image?: string, Quittio\Core\docker?: string, Quittio\Core\timeout?: int, Quittio\Core\fail_on_unavailable?: bool}|null | null = disabled |
Methods#
| Method | Description |
|---|---|
->__construct() | |
::countrySettings() | The settings of the country packs: the entries with a lower-case code and an array, e.g. 'de' => ['consumer_default_notice' => false]; others (e.g. pack classes) are left out. |
::fromArray() | Builds the configuration from an array with the core's own, flat layout (not the layout of the Laravel config/quittio.php). Keys, all optional: |
->with() |
__construct()#
public function __construct(
string|null $format = null,
string|null $profile = null,
?string $locale = null,
?string $country = null,
string $template = 'default',
list<string> $templatePaths = [],
string $filename = '{title}_{number}.{ext}',
bool $pdfa = true,
bool $b2cEmbedXml = false,
bool $autoUpgradeProfile = true,
string $validation = self::VALIDATION_ERROR,
list<ValidationLevel> $validationLevels = [\Quittio\Core\Validation\ValidationLevel::L1, \Quittio\Core\Validation\ValidationLevel::L2, \Quittio\Core\Validation\ValidationLevel::L3, \Quittio\Core\Validation\ValidationLevel::L4, \Quittio\Core\Validation\ValidationLevel::L7],
array{mode?: string, url?: string, jar?: string|null, configurations?: list<array{scenarios: string, repository: string}>, java?: string, timeout?: int, fail_on_unavailable?: bool}|null $kosit = null,
array{mode?: string, binary?: string, image?: string, docker?: string, timeout?: int, fail_on_unavailable?: bool}|null $veraPdf = null,
string $mandatoryFields = \Quittio\Core\View\MandatoryFieldGuard::MODE_EXCEPTION,
string $girocodeAmount = 'due',
?string $tempDir = null,
array<string, mixed> $options = [],
Presentation|null $presentation = null,
bool $blockOnWarnings = false,
int $maxXmlBytes = \Quittio\Core\Xml\XmlSecurity::DEFAULT_MAX_BYTES,
int $maxPdfBytes = 25 * 1024 * 1024,
int $maxDecompressedBytes = 50 * 1024 * 1024,
int|null $dueDays = null,
string|null $cancellationStrategy = null,
string|null $validationLocale = null,
RuleOverrides $rules = new \Quittio\Core\Validation\RuleOverrides(),
CalculationPolicy $calculation = new \Quittio\Core\Calculation\CalculationPolicy(),
array<string, array<string, mixed>> $countrySettings = [],
)| Parameter | Type | Description |
|---|---|---|
$format | string|null = null | default output format, null = automatic choice |
$profile | string|null = null | default profile for every format that allows it; null = the profile of the format or of the automatic choice (EN 16931 for ZUGFeRD/Factur-X) |
$locale | ?string = null | |
$country | ?string = null | |
$template | string = 'default' | |
$templatePaths | list<string> = [] | directories for plain PHP templates |
$filename | string = '{title}_{number}.{ext}' | |
$pdfa | bool = true | |
$b2cEmbedXml | bool = false | |
$autoUpgradeProfile | bool = true | |
$validation | string = self::VALIDATION_ERROR | error (throw on errors), warn (attach result only) or off |
$validationLevels | list<ValidationLevel> = [\Quittio\Core\Validation\ValidationLevel::L1, \Quittio\Core\Validation\ValidationLevel::L2, \Quittio\Core\Validation\ValidationLevel::L3, \Quittio\Core\Validation\ValidationLevel::L4, \Quittio\Core\Validation\ValidationLevel::L7] | levels run while rendering |
$kosit | array{Quittio\Core\mode?: string, Quittio\Core\url?: string, Quittio\Core\jar?: string|null, Quittio\Core\configurations?: list<array{scenarios: string, repository: string}>, Quittio\Core\java?: string, Quittio\Core\timeout?: int, Quittio\Core\fail_on_unavailable?: bool}|null = null | null = disabled |
$veraPdf | array{Quittio\Core\mode?: string, Quittio\Core\binary?: string, Quittio\Core\image?: string, Quittio\Core\docker?: string, Quittio\Core\timeout?: int, Quittio\Core\fail_on_unavailable?: bool}|null = null | null = disabled |
$mandatoryFields | string = \Quittio\Core\View\MandatoryFieldGuard::MODE_EXCEPTION | |
$girocodeAmount | string = 'due' | |
$tempDir | ?string = null | |
$options | array<string, mixed> = [] | options for validation rules and the view model |
$presentation | Presentation|null = null | design defaults (logo, colours, texts); the invoice's own values win |
$blockOnWarnings | bool = false | |
$maxXmlBytes | int = \Quittio\Core\Xml\XmlSecurity::DEFAULT_MAX_BYTES | |
$maxPdfBytes | int = 25 * 1024 * 1024 | |
$maxDecompressedBytes | int = 50 * 1024 * 1024 | |
$dueDays | int|null = null | due date (BT-9) = issue date + days for invoices without due date and payment terms |
$cancellationStrategy | string|null = null | credit_note or negative_invoice; null = default of the country pack |
$validationLocale | string|null = null | language of validation messages: null or "invoice" = the language of the invoice, "app" = the language of the application translator (Laravel: app()->getLocale()), or a locale |
$rules | RuleOverrides = new \Quittio\Core\Validation\RuleOverrides() | PHP rules switched off, re-rated or replaced by code |
$calculation | CalculationPolicy = new \Quittio\Core\Calculation\CalculationPolicy() | what the calculator does with declared amounts |
$countrySettings | array<string, array<string, mixed>> = [] | settings of the country packs by lower-case code, e.g. ['de' => ['consumer_default_notice' => false]] (Laravel: quittio.countries.de) |
countrySettings()#
public static function countrySettings(
array<array-key, mixed> $countries,
): array<string, array<string, mixed>>The settings of the country packs: the entries with a lower-case code and an array, e.g. 'de' => ['consumer_default_notice' => false]; others (e.g. pack classes) are left out.
| Parameter | Type | Description |
|---|---|---|
$countries | array<array-key, mixed> |
- Returns
array<string, array<string, mixed>>
fromArray()#
public static function fromArray(array<string, mixed> $config): selfBuilds the configuration from an array with the core's own, flat layout (not the layout of the Laravel config/quittio.php). Keys, all optional:
- format ("auto" or null = automatic choice), profile, locale, country, due_days
- template, template_paths (directories with {name}.php), filename
- pdf.pdfa, pdf.b2c_embed_xml, pdf.girocode_amount (due, discounted)
- auto_upgrade_profile
- validation.mode (error, warn, off), validation.levels (enum names L1 … L7, e.g. ['L1', 'L4']), validation.block_on_warnings, validation.rules (disabled, severity, allow_official; see RuleOverrides)
- validation.kosit, validation.verapdf: ['enabled' => true, …] switches the driver on; the other keys are those of the $kosit and $veraPdf parameters (KoSIT scenario sets only in "configurations")
- mandatory_fields (exception, log, off), temp_dir, options (e.g. paper, markdown, fold_marks, watermark)
- presentation (a Presentation object)
- reader.max_xml_bytes, reader.max_pdf_bytes, reader.max_decompressed_bytes
- corrections.cancellation_strategy
- countries.{code}: settings of a country pack, e.g. countries.de.consumer_default_notice
- calculation.declared_amounts (keep, recalculate, reject; see DeclaredAmountsMode)
The Laravel names differ, e.g. defaults.format, format_resolver.b2c_embed_xml, validation.levels php/xsd/kosit/verapdf, validation.mandatory_field_guard and pdf.cache_path.
| Parameter | Type | Description |
|---|---|---|
$config | array<string, mixed> |
- Returns
self
with()#
public function with(array<string, mixed> $changes): self| Parameter | Type | Description |
|---|---|---|
$changes | array<string, mixed> |
- Returns
self