Zum Inhalt springen

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#

ConstantValueDescription
VALIDATION_ERROR'error'
VALIDATION_OFF'off'
VALIDATION_WARN'warn'

Properties#

PropertyTypeDescription
$autoUpgradeProfile readonlybool
$b2cEmbedXml readonlybool
$blockOnWarnings readonlybool
$calculation readonlyCalculationPolicywhat the calculator does with declared amounts
$cancellationStrategy readonlystring|nullcredit_note or negative_invoice; null = default of the country pack
$country readonly?string
$countrySettings readonlyarray<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 readonlyint|nulldue date (BT-9) = issue date + days for invoices without due date and payment terms
$filename readonlystring
$format readonlystring|nulldefault output format, null = automatic choice
$girocodeAmount readonlystring
$kosit readonlyarray{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}|nullnull = disabled
$locale readonly?string
$mandatoryFields readonlystring
$maxDecompressedBytes readonlyint
$maxPdfBytes readonlyint
$maxXmlBytes readonlyint
$options readonlyarray<string, mixed>options for validation rules and the view model
$pdfa readonlybool
$presentation readonlyPresentation|nulldesign defaults (logo, colours, texts); the invoice's own values win
$profile readonlystring|nulldefault 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 readonlyRuleOverridesPHP rules switched off, re-rated or replaced by code
$tempDir readonly?string
$template readonlystring
$templatePaths readonlylist<string>directories for plain PHP templates
$validation readonlystringerror (throw on errors), warn (attach result only) or off
$validationLevels readonlylist<ValidationLevel>levels run while rendering
$validationLocale readonlystring|nulllanguage 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 readonlyarray{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}|nullnull = disabled

Methods#

MethodDescription
->__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 = [],
)
ParameterTypeDescription
$formatstring|null = nulldefault output format, null = automatic choice
$profilestring|null = nulldefault 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
$templatestring = 'default'
$templatePathslist<string> = []directories for plain PHP templates
$filenamestring = '{title}_{number}.{ext}'
$pdfabool = true
$b2cEmbedXmlbool = false
$autoUpgradeProfilebool = true
$validationstring = self::VALIDATION_ERRORerror (throw on errors), warn (attach result only) or off
$validationLevelslist<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
$kositarray{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 = nullnull = disabled
$veraPdfarray{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 = nullnull = disabled
$mandatoryFieldsstring = \Quittio\Core\View\MandatoryFieldGuard::MODE_EXCEPTION
$girocodeAmountstring = 'due'
$tempDir?string = null
$optionsarray<string, mixed> = []options for validation rules and the view model
$presentationPresentation|null = nulldesign defaults (logo, colours, texts); the invoice's own values win
$blockOnWarningsbool = false
$maxXmlBytesint = \Quittio\Core\Xml\XmlSecurity::DEFAULT_MAX_BYTES
$maxPdfBytesint = 25 * 1024 * 1024
$maxDecompressedBytesint = 50 * 1024 * 1024
$dueDaysint|null = nulldue date (BT-9) = issue date + days for invoices without due date and payment terms
$cancellationStrategystring|null = nullcredit_note or negative_invoice; null = default of the country pack
$validationLocalestring|null = nulllanguage of validation messages: null or "invoice" = the language of the invoice, "app" = the language of the application translator (Laravel: app()->getLocale()), or a locale
$rulesRuleOverrides = new \Quittio\Core\Validation\RuleOverrides()PHP rules switched off, re-rated or replaced by code
$calculationCalculationPolicy = new \Quittio\Core\Calculation\CalculationPolicy()what the calculator does with declared amounts
$countrySettingsarray<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>>

static

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.

ParameterTypeDescription
$countriesarray<array-key, mixed>
Returns
array<string, array<string, mixed>>

fromArray()#

public static function fromArray(array<string, mixed> $config): self

static

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:

  • 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.

ParameterTypeDescription
$configarray<string, mixed>
Returns
self

with()#

public function with(array<string, mixed> $changes): self
ParameterTypeDescription
$changesarray<string, mixed>
Returns
self

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.