Skip to content

Invoices 2.0.0

Latest

Choose a tag to compare

@ConsoleTVs ConsoleTVs released this 29 Nov 12:47
2f984c1

Breaking release.

See UPGRADE.md for every change with before and after code.

Changed

  • Requires PHP ^8.4, Laravel 12 or 13 and nesbot/carbon ^3.15. Laravel 10 and 11 and PHP 8.1 to 8.3 stay on 1.x.

  • Moved to src/. The main class is ConsoleTVs\Invoices\Invoice; ConsoleTVs\Invoices\Classes\Invoice remains as a
    deprecated class_alias. Config is config/invoices.php, views are resources/views, currencies are
    resources/currencies.json.

  • Fully typed (declare(strict_types=1), native types, #[\Override]). Invoice state uses protected(set) properties:
    readable by templates, writable only through fluent setters.

  • The API is camelCase: dueDate(), withPagination(), duplicateHeader(), taxRates(), and so on. The snake_case
    methods are removed. quantity replaces amount / ammount.

  • Money lives in Support\Money and is string based end to end; formatting no longer goes through floats, so large
    amounts keep every digit. Public lineTotal(), subtotal(), tax(), taxTotal(), total(), format().

  • PdfRenderer (container bound, configured from invoices.pdf.*) replaces the static PDF::generate(). PHP
    execution stays off and TLS stays verified.

  • The default tax_rates config is an empty list; the blank placeholder rate of 1.x configs is ignored.

  • The default template uses the new API and prints an item description when there is one.

  • download() and show() return an Illuminate\Http\Response instead of streaming to the output; stream() is an
    alias. The name is optional and .pdf is appended.

  • The default font is Helvetica instead of DejaVu Sans (much smaller PDFs). Non-Latin scripts need font('DejaVu Sans').

  • The default template is translated and prints dates and, with ext-intl, amounts in the invoice locale. Invoice::$name
    is nullable (use heading()), Party::lines() takes the id label.

  • Percentage taxes are calculated on the tax base (subtotal minus discounts plus taxable fees).

  • Requires illuminate/contracts, illuminate/http and illuminate/translation; suggests ext-intl and illuminate/mail.

Added

  • Laravel integration: the invoice is Responsable, Htmlable (toHtml()) and Attachable (->attach($invoice) in
    Mailables and notifications); filename().

  • Translations for English, Spanish, Catalan, French, German, Italian, Portuguese and Dutch, the invoices-translations
    publish tag and locale().

  • Locale aware currency formatting (money(), Number::currency() with an exact fallback beyond float precision) and dates.

  • font() and the font config key; direction() and automatic right to left layout for ar, fa, he, ur.

  • discount() and fee() (taxable or not) with discountTotal(), feeTotal() and taxBase().

  • Document types (Invoice::quote(), receipt() ("Payment date", no due date), creditNote(), proforma(), type()) and status stamps
    (stamp(), paid(), void()).

  • Exceptions InvalidDirection, InvalidFont and InvalidAdjustment.

  • Item, TaxRate and Party value objects (with fromArray() factories, so arrays keep working); TaxType,
    Orientation and Paper enums.

  • addItems(), output(), logo($url, $height), Party email and extra lines, item description.

  • ConsoleTVs\Invoices\Facades\Invoice facade (no global alias), InvoiceFactory, Macroable, Conditionable and Tappable.

  • Publish tags invoices-config and invoices-views (invoices still publishes both).

  • Specific exceptions under Exceptions\, all InvalidArgumentExceptions.

  • PHPStan level 9 (Larastan) and Pint, run in CI; CI on PHP 8.4 to 8.6 with Laravel 12 and 13.

  • UPGRADE.md, AGENTS.md, CONTRIBUTING.md, issue and pull request templates.

Removed

  • The stale docs/1/readme.md.

  • The snake_case methods, formatCurrency(), detailLines(), isPlaceholderTaxRate(), Classes\PDF and
    Traits\Setters.

Upgrading from 1.x: see UPGRADE.md.